diff --git a/web/client/src/layout/components/header/index.jsx b/web/client/src/layout/components/header/index.jsx index d338a87..88effec 100644 --- a/web/client/src/layout/components/header/index.jsx +++ b/web/client/src/layout/components/header/index.jsx @@ -6,160 +6,175 @@ import { IconTreeTriangleDown } from '@douyinfe/semi-icons'; import "./index.less"; const Header = (props) => { - const { dispatch, history, user, actions, socket, headerItems, tochange } = props; + const { dispatch, history, user, actions, socket, headerItems, tochange } = props; + let userRole = user?.pomsUserInfo?.role + let modalRole = [] + if (userRole) { + let modal = [] + userRole?.map(v => { + if (v == 'data_analyst') ['analysis', 'data', 'workOrder', 'means'].map(u => modal.push(u)) + if (v == 'after_sale') ['problem', 'facility', 'workOrder', 'means'].map(u => modal.push(u)) + if (v == 'resource_manage') ['facility', 'workOrder', 'means'].map(u => modal.push(u)) + if (v == 'customer_service') ['service', 'workOrder', 'means'].map(u => modal.push(u)) + }) + modal.push('console') + modal = [...new Set(modal)] + modalRole = headerItems?.filter(v => modal.includes(v.itemKey)) + if (userRole?.includes('SuperAdmin') || userRole?.includes('admin')) modalRole = headerItems - return ( - <> -
-
+ } + > +
+
+ + {user?.name?.substr(0, 1)} + +
+ {user.name} +
v.name + '、')} style={{ width: 60, overflow: 'hidden', whiteSpace: 'nowrap', textOverflow: 'ellipsis', color: '#969799', fontSize: 12 }}>{user?.department?.map(v => v.name + '、')}
+
+
+
+
{ + history.push(`/userCenter`); + }}> +
+ +
+
+ 用户中心 +
+
+
+
+ +
+
+ 安全认证 +
+
+
{ + dispatch(actions.auth.logout(user)); + if (socket) { + socket.disconnect(); + } + history.push(`/signin`); + }}> + 退出 + {/* */} +
- {/* collapseButton collapseText */} + {/* collapseButton collapseText */} - - - } - /> - - - ); + + + } + /> + + + ); }; function mapStateToProps (state) { - const { global, auth, webSocket } = state; - return { - actions: global.actions, - user: auth.user, - socket: webSocket.socket, - }; + const { global, auth, webSocket } = state; + return { + actions: global.actions, + user: auth.user, + socket: webSocket.socket, + }; } export default connect(mapStateToProps)(Header); diff --git a/web/client/src/sections/console/containers/console.jsx b/web/client/src/sections/console/containers/console.jsx index 913161c..a104ed0 100644 --- a/web/client/src/sections/console/containers/console.jsx +++ b/web/client/src/sections/console/containers/console.jsx @@ -33,8 +33,7 @@ const Console = (props) => { const [problemsList, setProblemsList] = useState(['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''])//异常&问题列表 useEffect(() => { - // ACTION 示例 - // dispatch(actions.example.getMembers(user.orgId)) + }, []) useEffect(() => { newScrollbar = new PerfectScrollbar("#news", { @@ -91,19 +90,7 @@ const Console = (props) => { // dispatch(actions.example.getMembers(user.orgId)) }) - // websocket 使用测试 - // useEffect(() => { - // console.log(socket) - // if (socket) { - // socket.on('TEST', function (msg) { - // console.info(msg); - // }); - // return () => { - // socket.off("TEST"); - // } - // } - // }, [socket]) return ( <> @@ -112,10 +99,10 @@ const Console = (props) => {
- HI,欢迎回来,行业服务部 + HI,欢迎回来,
- 刘昊然! + {user?.name}
@@ -383,8 +370,8 @@ const Console = (props) => {
-
我的工作台
-
MY WORK STATION
+
BI分析模块
+
BI ANAL YSIS MODEL
setSetup(true)} /> @@ -529,7 +516,7 @@ function mapStateToProps (state) { const { auth, global, members, webSocket } = state; return { // loading: members.isRequesting, - // user: auth.user, + user: auth.user, // actions: global.actions, // members: members.data, // socket: webSocket.socket diff --git a/web/client/src/sections/install/components/memberModal.jsx b/web/client/src/sections/install/components/memberModal.jsx index ed20739..48b6808 100644 --- a/web/client/src/sections/install/components/memberModal.jsx +++ b/web/client/src/sections/install/components/memberModal.jsx @@ -27,7 +27,7 @@ function memberModal (props) { { label: '数据分析师', value: 'data_analyst', - text: '拥有数据分析、工单管理的权限、资料相关的权限' + text: '拥有数据、分析、工单、资料相关的权限' }, { label: '售后运维', value: 'after_sale', diff --git a/web/client/src/sections/install/containers/roles.jsx b/web/client/src/sections/install/containers/roles.jsx index 96d399e..08227fc 100644 --- a/web/client/src/sections/install/containers/roles.jsx +++ b/web/client/src/sections/install/containers/roles.jsx @@ -130,7 +130,7 @@ const Roles = (props) => { title: (
数据分析师 - +
diff --git a/web/client/src/sections/problem/components/inspection.jsx b/web/client/src/sections/problem/components/inspection.jsx index 7c28cb4..ebf354d 100644 --- a/web/client/src/sections/problem/components/inspection.jsx +++ b/web/client/src/sections/problem/components/inspection.jsx @@ -63,7 +63,11 @@ const Inspection = ({ dispatch, actions, user, route, statistic }) => { }) useEffect(() => { - dispatch(problem.getAlarmLnspection(checkPatrol)).then((res) => { + dispatch(problem.getAlarmLnspection({ + timeStart: moment().day(moment().day() - 1).startOf('day').format('YYYY-MM-DD HH:mm:ss'), + timeEnd: moment().endOf('day').format('YYYY-MM-DD HH:mm:ss') + , ...checkPatrol + })).then((res) => { if (res.success) { setPatrolAbnormal(res.payload.data) setNotRead(res.payload.data.filter(v => !v.notedTime).length) @@ -97,11 +101,12 @@ const Inspection = ({ dispatch, actions, user, route, statistic }) => { {statistic[route]} APPLY SEMI-AUTOMATIC INSPECTION -
仅保留48小时内的图片数据,每日8时、14时、17时系统巡检一次。未阅共{notRead}个
+
仅保留近两天的图片数据,每日8时、14时、17时系统巡检一次。未阅共{notRead}个
{ + console.log(v.time) setCheckPatrol({ appId: v.appId, noted: v.noted, @@ -109,11 +114,11 @@ const Inspection = ({ dispatch, actions, user, route, statistic }) => { timeStart: v.time == 'true' ? moment().startOf('day').format('YYYY-MM-DD HH:mm:ss') : v.time == 'false' ? - moment().day(moment().day() - 1).startOf('day').format('YYYY-MM-DD HH:mm:ss') : "", + moment().day(moment().day() - 1).startOf('day').format('YYYY-MM-DD HH:mm:ss') : moment().day(moment().day() - 1).startOf('day').format('YYYY-MM-DD HH:mm:ss'), timeEnd: v.time == 'true' ? moment().endOf('day').format('YYYY-MM-DD HH:mm:ss') : v.time == 'false' ? - moment().day(moment().day() - 1).endOf('day').format('YYYY-MM-DD HH:mm:ss') : "", + moment().day(moment().day() - 1).endOf('day').format('YYYY-MM-DD HH:mm:ss') : moment().endOf('day').format('YYYY-MM-DD HH:mm:ss'), }) }} getFormApi={(formApi) => (api.current = formApi)} diff --git a/web/client/src/sections/problem/containers/dataAlarm.jsx b/web/client/src/sections/problem/containers/dataAlarm.jsx index 60fb2da..6136bb7 100644 --- a/web/client/src/sections/problem/containers/dataAlarm.jsx +++ b/web/client/src/sections/problem/containers/dataAlarm.jsx @@ -163,9 +163,9 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket, iotVcmpWeb dataLnterrupt: ['index', 'projectName', 'StructureName', 'SourceName', 'AlarmGroupUnit', 'AlarmCodeName', 'sustainTime', 'createTime', 'AlarmContent', 'CurrentLevel', 'updateTime', 'detailCount', 'confirm', 'confirmTime',], dataAbnormal: ['index', 'projectName', 'StructureName', 'SourceName', 'type', 'alarmType', 'createTime', 'sustainTime', 'AlarmContent', 'CurrentLevel', 'updateTime', 'detailCount', 'confirm', 'confirmTime'], strategyHit: ['index', 'projectName', 'StructureName', 'SourceName', 'Strategy', 'State', 'createTime', 'sustainTime', 'AlarmContent', 'CurrentLevel', 'updateTime', 'detailCount', 'confirm', 'confirmTime'], - videoAbnormal: ['index', 'projectName', 'StructureName', 'SourceName', 'station', 'cameraKindId', 'venderName', 'point', 'cameraSerialNo', 'cameraChannelNo', 'platform', 'AlarmContent', 'resolve', 'createTime', 'updateTime', 'confirm', 'confirmTime', 'camerOnline'], - useAbnormal: ['index', 'projectName', 'appName', 'url', 'type', 'alarmContent', 'createTime', 'updateTime', 'confirm', 'confirmTime'], - deviceAbnormal: ['index', 'projectName', 'StructureName', 'SourceName', 'station', 'type', 'cameraKindId', 'venderName', 'AlarmContent', 'AlarmCodeName', 'createTime', 'updateTime', 'confirm', 'confirmTime'], + videoAbnormal: ['index', 'projectName', 'StructureName', 'SourceName', 'station', 'cameraKindId', 'sustainTime', 'venderName', 'point', 'cameraSerialNo', 'cameraChannelNo', 'platform', 'AlarmContent', 'resolve', 'createTime', 'updateTime', 'confirm', 'confirmTime', 'camerOnline'], + useAbnormal: ['index', 'projectName', 'appName', 'url', 'type', 'alarmContent', 'createTime', 'sustainTime', 'updateTime', 'confirm', 'confirmTime'], + deviceAbnormal: ['index', 'projectName', 'StructureName', 'SourceName', 'station', 'type', 'cameraKindId', 'sustainTime', 'venderName', 'AlarmContent', 'AlarmCodeName', 'createTime', 'updateTime', 'confirm', 'confirmTime'], } //表格默认配置信息 const columns = { @@ -231,7 +231,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket, iotVcmpWeb
: "" } }, - { name: '测点', sort: 4.1, value: 'point', render: (_, r, index) => r.station?.map(v =>
{v.name}
) }, + { name: '测点', sort: 4.1, value: 'point', render: (_, r, index) => r.station?.length > 0 ? r.station?.map(v =>
{v.name}
) : "无" }, { name: '中断类型', sort: 6, value: 'AlarmGroupUnit' }, { name: '告警信息', sort: 5, value: 'AlarmContent' }, { name: '常见原因', sort: 7, value: 'AlarmCodeName' }, @@ -257,7 +257,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket, iotVcmpWeb { name: '持续时间', sort: 19.5, value: 'sustainTime', render: (_, r, index) => { // console.log(r.updateTime); - let time = moment(r.updateTime).diff(moment(r.createTime), 'seconds') + let time = moment(r.confirmTime || r.updateTime || moment().format("YYYY-MM-DD HH:mm:ss")).diff(moment(r.createTime), 'seconds') // console.log(time); return time < 60 ? '< 1分钟' : time > 3600 ? Math.floor(time / 3600) + '小时' + Math.floor((time - Math.floor(time / 3600) * 3600) / 60) + '分钟' : Math.floor((time - Math.floor(time / 3600) * 3600) / 60) + '分钟' } @@ -279,7 +279,7 @@ const DataAlarm = ({ match, dispatch, actions, user, loading, socket, iotVcmpWeb return '当前' } }, - { name: '位置信息', sort: 11, value: 'station', render: (_, r, index) => route == 'deviceAbnormal' ? r.station : r.station?.map(v =>
{v.position}
) }, + { name: '位置信息', sort: 11, value: 'station', render: (_, r, index) => route == 'deviceAbnormal' ? r.station : r.station?.length > 0 ? r.station?.map(v =>
{v.position}
) : "无" }, { name: '设备类型', sort: 6, value: 'cameraKindId', },