Browse Source

解决普通成员没有控制台权限问题

dev
wenlele 1 year ago
parent
commit
211e799700
  1. 93
      api/app/lib/controllers/control/toolLink.js
  2. 13
      web/client/src/layout/components/header/index.jsx

93
api/app/lib/controllers/control/toolLink.js

@ -255,16 +255,24 @@ async function count (ctx) {
SELECT SELECT
cameraAlarm.cameraId AS cameraId, cameraAlarm.cameraId AS cameraId,
cameraAlarm.cameraName AS cameraName, cameraAlarm.cameraName AS cameraName,
cameraAlarm.cameraKindId AS cameraKindId,
cameraAlarm.statusId AS statusId,
cameraAlarm.venderId AS venderId,
cameraAlarm.venderName AS venderName,
cameraAlarm.cameraSerialNo AS cameraSerialNo, cameraAlarm.cameraSerialNo AS cameraSerialNo,
cameraAlarm.cameraChannelNo AS cameraChannelNo, cameraAlarm.cameraChannelNo AS cameraChannelNo,
cameraAlarm.alarmId AS alarmId, cameraAlarm.alarmId AS alarmId,
cameraAlarm.createTime AS createTime, cameraAlarm.createTime AS createTime,
cameraAlarm.updateTime AS updateTime,
cameraAlarm.platform AS platform, cameraAlarm.platform AS platform,
cameraAlarm.confirmContent AS confirmContent,
cameraAlarm.confirmTime AS confirmTime, cameraAlarm.confirmTime AS confirmTime,
${'cameraAlarm.autoRestore AS autoRestore,'}
camera_status_resolve.id AS resolveId, camera_status_resolve.id AS resolveId,
camera_status.describe AS statusDescribe, camera_status.describe AS statusDescribe,
camera_status_resolve.resolve AS resolve, camera_status_resolve.resolve AS resolve,
"gbCamera".online AS cameraOnline, "gbCamera".online AS cameraOnline,
secret_yingshi.token AS yingshiToken,
anxinIpc.t_video_ipc.name AS anxinIpcPosition, anxinIpc.t_video_ipc.name AS anxinIpcPosition,
anxinStation.id AS anxinStationId, anxinStation.id AS anxinStationId,
anxinStation.name AS anxinStationName, anxinStation.name AS anxinStationName,
@ -276,12 +284,19 @@ async function count (ctx) {
camera.id AS cameraId, camera.id AS cameraId,
camera.gb_id AS gbId, camera.gb_id AS gbId,
camera.name AS cameraName, camera.name AS cameraName,
camera.kind_id AS cameraKindId,
camera.vender_id AS venderId,
camera.yingshi_secret_id AS yingshiSecretId,
vender.name AS venderName,
camera_status_alarm.id AS alarmId, camera_status_alarm.id AS alarmId,
camera_status_alarm.create_time AS createTime, camera_status_alarm.create_time AS createTime,
camera_status_alarm.update_time AS updateTime,
camera_status_alarm.platform AS platform, camera_status_alarm.platform AS platform,
camera_status_alarm.status_id AS statusId, camera_status_alarm.status_id AS statusId,
camera_status_alarm.serial_no AS cameraSerialNo, camera_status_alarm.serial_no AS cameraSerialNo,
camera_status_alarm.channel_no AS cameraChannelNo, camera_status_alarm.channel_no AS cameraChannelNo,
camera_status_alarm.confirm AS confirmContent,
${'camera_status_alarm.auto_restore AS autoRestore,'}
camera_status_alarm.confirm_time AS confirmTime camera_status_alarm.confirm_time AS confirmTime
FROM camera_status_alarm FROM camera_status_alarm
INNER JOIN camera INNER JOIN camera
@ -292,14 +307,14 @@ async function count (ctx) {
WHERE WHERE
camera.delete = '0' camera.delete = '0'
AND camera.recycle_time is null AND camera.recycle_time is null
AND camera_status_alarm.create_time >= '${moment().startOf("day").format('YYYY-MM-DD HH:mm:ss')}'
AND alarmId IN ( AND alarmId IN (
SELECT camera_status_alarm.id AS alarmId SELECT camera_status_alarm.id AS alarmId
FROM camera_status_alarm FROM camera_status_alarm
RIGHT JOIN ${anxinyun}.t_video_ipc RIGHT JOIN ${anxinyun}.t_video_ipc
ON toString(${anxinyun}.t_video_ipc.channel_no) = camera_status_alarm.channel_no ON toString(${anxinyun}.t_video_ipc.channel_no) = camera_status_alarm.channel_no
AND ${anxinyun}.t_video_ipc.serial_no = camera_status_alarm.serial_no AND ${anxinyun}.t_video_ipc.serial_no = camera_status_alarm.serial_no
${`WHERE ${anxinyun}.t_video_ipc.structure IN (${anxinStrucIds.join(',')}, -1)` ${`WHERE ${anxinyun}.t_video_ipc.structure IN (${anxinStrucIds.join(',')})`}
}
) )
) AS cameraAlarm ) AS cameraAlarm
LEFT JOIN camera_status LEFT JOIN camera_status
@ -309,12 +324,15 @@ async function count (ctx) {
ON camera_status_resolve.status_id = camera_status.id ON camera_status_resolve.status_id = camera_status.id
LEFT JOIN "gbCamera" LEFT JOIN "gbCamera"
ON "gbCamera".id = cameraAlarm.gbId ON "gbCamera".id = cameraAlarm.gbId
LEFT JOIN "secret_yingshi"
ON "secret_yingshi".id = cameraAlarm.yingshiSecretId
LEFT JOIN ${anxinyun}.t_video_ipc AS anxinIpc LEFT JOIN ${anxinyun}.t_video_ipc AS anxinIpc
ON toString(anxinIpc.channel_no) = cameraAlarm.cameraChannelNo ON toString(anxinIpc.channel_no) = cameraAlarm.cameraChannelNo
AND anxinIpc.serial_no = cameraAlarm.cameraSerialNo AND anxinIpc.serial_no = cameraAlarm.cameraSerialNo
LEFT JOIN ${anxinyun}.t_structure AS anxinStruc LEFT JOIN ${anxinyun}.t_structure AS anxinStruc
ON anxinStruc.id = anxinIpc.structure ON anxinStruc.id = anxinIpc.structure
AND anxinStruc.id IN (${anxinStrucIds.join(',')}, -1) AND anxinStruc.id IN (${anxinStrucIds.join(',')})
LEFT JOIN ${anxinyun}.t_video_ipc_station AS anxinIpcStation LEFT JOIN ${anxinyun}.t_video_ipc_station AS anxinIpcStation
ON anxinIpcStation.ipc = anxinIpc.id ON anxinIpcStation.ipc = anxinIpc.id
LEFT JOIN ${anxinyun}.t_sensor AS anxinStation LEFT JOIN ${anxinyun}.t_sensor AS anxinStation
@ -328,16 +346,83 @@ async function count (ctx) {
for (let a of alarmRes) { for (let a of alarmRes) {
if (positionD[a.cameraId]) { if (positionD[a.cameraId]) {
let curD = returnD[positionD[a.cameraId].positionReturnD] let curD = returnD[positionD[a.cameraId].positionReturnD]
if (a.resolveId && !curD.resolve.some(r => r.id == a.resolveId)) {
curD.resolve.push({
id: a.resolveId,
resolve: a.resolve
})
}
if (a.strucId && !curD.struc.some(s => s.id == a.strucId)) {
curD.struc.push({
id: a.strucId,
projectId: a.projectId,
name: a.strucName
})
}
if (a.anxinStationId && !curD.station.some(s => s.id == a.anxinStationId)) {
curD.station.push({
id: a.anxinStationId,
name: a.anxinStationName,
position: a.anxinIpcPosition
})
}
} else { } else {
let d = { let d = {
cameraId: a.cameraId, cameraId: a.cameraId,
cameraName: a.cameraName, cameraName: a.cameraName,
statusId: a.statusId,
camerOnline: a.cameraOnline,
cameraSerialNo: a.cameraSerialNo,
cameraChannelNo: a.cameraChannelNo,
autoRestore: a.autoRestore,
createTime: a.createTime, createTime: a.createTime,
updateTime: a.updateTime,
platform: a.platform,
statusDescribe: a.statusDescribe,
alarmId: a.alarmId, alarmId: a.alarmId,
confirmContent: a.confirmContent,
confirmTime: a.confirmTime, confirmTime: a.confirmTime,
venderId: a.venderId,
venderName: a.venderName,
cameraKindId: a.cameraKindId,
yingshiToken: a.yingshiToken,
resolve: [],
struc: [],
station: []
} }
// pep 项目
d.pomsProject = (
anxinStruc.find(as => as.strucId == a.strucId) ||
{
pomsProject: [
]
}
).pomsProject
if (a.resolveId) {
d.resolve.push({
id: a.resolveId,
resolve: a.resolve
})
}
if (a.strucId) {
d.struc.push({
id: a.strucId,
projectId: a.projectId,
name: a.strucName
})
}
if (a.anxinStationId) {
d.station.push({
id: a.anxinStationId,
name: a.anxinStationName,
position: a.anxinIpcPosition
})
}
returnD.push(d) returnD.push(d)
positionD[a.cameraId] = { positionD[a.cameraId] = {
positionReturnD: returnD.length - 1 positionReturnD: returnD.length - 1

13
web/client/src/layout/components/header/index.jsx

@ -13,7 +13,7 @@ import layout from '../../containers/layout';
let newScrollbar; let newScrollbar;
const Header = (props) => { const Header = (props) => {
const { dispatch, history, user, actions, socket, headerItems, tochange, projectGroup } = props; const { dispatch, history, user, actions, socket, headerItems, tochange, projectGroup } = props;
const { install, projectGroup: projectGroupAC,layout } = actions const { install, projectGroup: projectGroupAC, layout } = actions
const [pomsList, setPomsList] = useState([]) const [pomsList, setPomsList] = useState([])
const [pomsName, setPomsName] = useState('全局') const [pomsName, setPomsName] = useState('全局')
const [pepProjectId, setPepProjectId] = useState() const [pepProjectId, setPepProjectId] = useState()
@ -24,7 +24,7 @@ const Header = (props) => {
const [customProjGroupModalVis, setCustomProjGroupModalVis] = useState(false) const [customProjGroupModalVis, setCustomProjGroupModalVis] = useState(false)
const [customProjGroupDelPopVis, setCustomProjGroupDelPopVis] = useState(false) const [customProjGroupDelPopVis, setCustomProjGroupDelPopVis] = useState(false)
const [customProjGroupEditData, setCustomProjGroupEditData] = useState(null) const [customProjGroupEditData, setCustomProjGroupEditData] = useState(null)
const [count,setCount]=useState(0)// const [count, setCount] = useState(0)//
// console.log('actions1',actions) // console.log('actions1',actions)
let userRole = user?.pomsUserInfo?.role let userRole = user?.pomsUserInfo?.role
let modalRole = [] let modalRole = []
@ -35,8 +35,9 @@ const Header = (props) => {
if (v == 'after_sale') ['problem', 'facility', '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 == 'resource_manage') ['facility', 'workOrder', 'means'].map(u => modal.push(u))
if (v == 'customer_service') ['service', 'workOrder', 'means'].map(u => modal.push(u)) if (v == 'customer_service') ['service', 'workOrder', 'means'].map(u => modal.push(u))
if (v == 'firmware_upgrade') modal.push('device') if (v == 'firmware_upgrade') modal.push('device')
}) })
modal.push('control')
modal = [...new Set(modal)] modal = [...new Set(modal)]
// console.log('headerItems',headerItems) // console.log('headerItems',headerItems)
@ -57,8 +58,8 @@ const Header = (props) => {
} }
}) })
getProjGroup() getProjGroup()
dispatch(layout.getWorkOrders()).then((res)=>{ dispatch(layout.getWorkOrders()).then((res) => {
if(res.success){ if (res.success) {
setCount(res.payload.data?.count) setCount(res.payload.data?.count)
} }
}) })
@ -299,7 +300,7 @@ const Header = (props) => {
<Nav.Sub <Nav.Sub
key={index + 'a'} key={index + 'a'}
itemKey={item.itemKey} itemKey={item.itemKey}
text={item.text==='工单'?`${item.text}${count}`:item.text} text={item.text === '工单' ? `${item.text}${count}` : item.text}
dropdownStyle={{ color: '#F2F3F5' }} dropdownStyle={{ color: '#F2F3F5' }}
> >
{item.hasOwnProperty('items') && item.items.map((ite, idx) => ( {item.hasOwnProperty('items') && item.items.map((ite, idx) => (

Loading…
Cancel
Save