wuqun 2 years ago
parent
commit
b194ff1bd1
  1. 20
      api/app/lib/controllers/alarm/app.js
  2. 2
      api/app/lib/controllers/alarm/data.js
  3. 18
      api/app/lib/controllers/alarm/video.js
  4. 7
      api/app/lib/controllers/organization/index.js
  5. 4
      api/app/lib/controllers/push/config.js
  6. 2
      api/app/lib/schedule/alarms_push.js
  7. 2
      web/client/src/sections/install/components/adminModal.jsx
  8. 3
      web/client/src/sections/install/components/memberModal.jsx
  9. 1215
      web/client/src/sections/install/containers/roles.jsx
  10. 2
      web/client/src/sections/install/containers/system.jsx
  11. 7
      web/client/src/sections/problem/components/tableData.jsx
  12. 8
      web/client/src/sections/problem/containers/dataAlarm.jsx
  13. 2
      web/client/src/sections/service/containers/emPush.jsx

20
api/app/lib/controllers/alarm/app.js

@ -2,7 +2,7 @@
const moment = require('moment')
const { alarmConfirmLog } = require('./alarmConfirmLog');
async function inspection(ctx) {
async function inspection (ctx) {
// 巡查
try {
const models = ctx.fs.dc.models;
@ -31,7 +31,7 @@ async function inspection(ctx) {
}
}
async function inspectionList(ctx) {
async function inspectionList (ctx) {
try {
const models = ctx.fs.dc.models;
const { clickHouse } = ctx.app.fs
@ -116,7 +116,7 @@ async function inspectionList(ctx) {
}
}
async function notedInspection(ctx) {
async function notedInspection (ctx) {
try {
const models = ctx.fs.dc.models;
const { inspectionId } = ctx.request.body
@ -141,7 +141,7 @@ async function notedInspection(ctx) {
}
}
async function apiError(ctx) {
async function apiError (ctx) {
try {
const { utils: { sendAppearToWeb } } = ctx.app.fs
const models = ctx.fs.dc.models;
@ -253,12 +253,12 @@ async function apiError(ctx) {
}
}
async function apiErrorList(ctx) {
async function apiErrorList (ctx) {
try {
const models = ctx.fs.dc.models;
const { clickHouse } = ctx.app.fs
const { utils: { anxinStrucIdRange, pomsProjectRange } } = ctx.app.fs
const { keyword, errType, confirmState, sustainTimeStart, sustainTimeEnd, limit, page, pepProjectId } = ctx.query
const { keyword, errType, confirmState, state, sustainTimeStart, sustainTimeEnd, limit, page, pepProjectId } = ctx.query
let pomsProject = await pomsProjectRange({
ctx, pepProjectId,
@ -311,10 +311,10 @@ async function apiErrorList(ctx) {
if (errType) {
findOption.where.type = errType // element / apiError
}
if (confirmState) {
if (confirmState == 'confirmd') {
if (confirmState || state) {
if (confirmState == 'confirmd' || state == 'histroy') {
findOption.where.confirmTime = { $ne: null }
} else if (confirmState == 'unconfirmed') {
} else if (confirmState == 'unconfirmed' || state == 'new') {
findOption.where.confirmTime = null
}
}
@ -365,7 +365,7 @@ async function apiErrorList(ctx) {
}
}
async function confirmApiError(ctx) {
async function confirmApiError (ctx) {
try {
const models = ctx.fs.dc.models;
const { confirm, appAlarmId = [], confirmPost } = ctx.request.body

2
api/app/lib/controllers/alarm/data.js

@ -40,10 +40,8 @@ async function list (ctx) {
ctx, pepProjectId, keywordTarget, keyword
})
let whereOption = []
// ! 1 开发临时增加
if (anxinStruc.length) {
const anxinStrucIds = anxinStruc.map(a => a.strucId)
// ! 开发临时注释
whereOption.push(`alarms.StructureId IN (${anxinStrucIds.join(",")})`)
if (groupId) {

18
api/app/lib/controllers/alarm/video.js

@ -1,7 +1,7 @@
'use strict';
const moment = require('moment')
const { alarmConfirmLog } = require('./alarmConfirmLog');
async function deviceType(ctx) {
async function deviceType (ctx) {
try {
const { models } = ctx.fs.dc;
const { clickHouse } = ctx.app.fs
@ -21,7 +21,7 @@ async function deviceType(ctx) {
}
}
async function alarmList(ctx) {
async function alarmList (ctx) {
try {
const { models } = ctx.fs.dc;
const { clickHouse } = ctx.app.fs
@ -46,7 +46,11 @@ async function alarmList(ctx) {
}
}
if (kindId) {
cameraWhereOption.push(`camera.kind_id = ${kindId}`)
let sql = `camera.kind_id = ${kindId}`
if (kindId == 1314) {
sql = `(camera.kind_id = ${kindId} OR camera.kind_id IS null)`
}
cameraWhereOption.push(sql)
}
let statusAlarmWhereOption = []
@ -262,7 +266,7 @@ async function alarmList(ctx) {
}
}
async function confirm(ctx) {
async function confirm (ctx) {
try {
const { alarmId, content, confirmPost } = ctx.request.body;
// TODO: 以视频·应用的秘钥进行鉴权
@ -288,7 +292,7 @@ let structsAche = {
dataList: [],
expireTime: null//10分钟更新一次结构物列表
}
async function getStructsAche(ctx) {
async function getStructsAche (ctx) {
const { utils: { getAxyStructs } } = ctx.app.fs
try {
if (!structsAche.dataList.length || moment() > moment(structsAche.expireTime)) {
@ -302,7 +306,7 @@ async function getStructsAche(ctx) {
}
}
async function alarmAdded(ctx) {
async function alarmAdded (ctx) {
try {
const { models } = ctx.fs.dc;
const { clickHouse } = ctx.app.fs
@ -362,7 +366,7 @@ async function alarmAdded(ctx) {
}
}
async function vcmpAppAuthToken(ctx) {
async function vcmpAppAuthToken (ctx) {
try {
const { models } = ctx.fs.dc;
const { utils: { vcmpAuth } } = ctx.app.fs

7
api/app/lib/controllers/organization/index.js

@ -74,7 +74,7 @@ async function editUser (ctx) {
if (existUserRes) {
// 存在且传递id 或者 不传id也存在
// 修改 update
storageData.deleted = false
if (
role.includes('admin')
) {
@ -89,6 +89,8 @@ async function editUser (ctx) {
// 正在修改成员 但是此时还是管理员
storageData.disabled = true
storageData.role = [...role, 'admin']
}else{
storageData.deleted = false
}
await models.User.update(storageData, {
where: {
@ -165,6 +167,9 @@ async function delAdmin (ctx) {
let adminIndex = updateValues.role.findIndex(r => r == 'admin')
if (adminIndex > -1) {
updateValues.role.splice(adminIndex, 1)
if (updateValues.role.length < 1) {
updateValues.deleted = true
}
}
await models.User.update(updateValues, {
where: {

4
api/app/lib/controllers/push/config.js

@ -34,7 +34,7 @@ async function list (ctx) {
if (keywordTarget == 'tactics') {
findOption.where.name = { $like: `%${keyword}%` }
} else if (keywordTarget == 'struc') {
let bindAnixinStrucRes = await clickHouse.projectManage.query(`
let bindAnixinStrucRes = await clickHouse.anxinyun.query(`
SELECT id, name FROM t_structure
WHERE name LIKE '%${keyword}%'
`).toPromise()
@ -144,7 +144,7 @@ async function list (ctx) {
...p,
pomsProject: corBind,
structure: returnStruc,
pushCount: corLogCount ? corLogCount.count : 0,
pushCount: corLogCount ? corLogCount.dataValues.count : 0,
receiverPepUser: corReceiver
})
}

2
api/app/lib/schedule/alarms_push.js

@ -358,11 +358,13 @@ module.exports = function (app, opts) {
order: [['createTime', 'DESC']],
include: [{
model: models.App,
required: true,
include: [{
model: models.ProjectApp,
where: {
projectId: pomsProjectId
},
required: true,
}]
}]
})

2
web/client/src/sections/install/components/adminModal.jsx

@ -117,6 +117,7 @@ function adminModal (props) {
style={{ width: 417 }}
rules={[{ required: true, message: "请选择部门" }]}
initValue={departmentId || ""}
filter
showClear
>
{
@ -139,6 +140,7 @@ function adminModal (props) {
rules={[{ required: true, message: "请选择人员" }]}
initValue={peopleId || ""}
showClear
filter
disabled={disablePeople}
>
{

3
web/client/src/sections/install/components/memberModal.jsx

@ -139,6 +139,7 @@ function memberModal (props) {
style={{ width: 417 }}
rules={[{ required: true, message: "请选择部门" }]}
showClear
filter
initValue={departmentId || ""}
disabled={memberEdit}
>
@ -157,6 +158,7 @@ function memberModal (props) {
<Form.Select
label="选择人员:"
field="pepUserId"
filter
placeholder="请选择人员"
style={{ width: 417 }}
rules={[{ required: true, message: "请选择人员" }]}
@ -208,6 +210,7 @@ function memberModal (props) {
placeholder="请选择关联项目"
initValue={anxincloudArr}
style={{ width: 417 }}
filter
showClear
>
{

1215
web/client/src/sections/install/containers/roles.jsx

File diff suppressed because it is too large

2
web/client/src/sections/install/containers/system.jsx

@ -56,7 +56,7 @@ const Example = (props) => {
dispatch(install.getProjectAppList(query)).then((res) => {//
setAppList(res.payload.data)
})
console.log('user',user);
}, [])
useEffect(() => {
getProjectPomsList();

7
web/client/src/sections/problem/components/tableData.jsx

@ -14,9 +14,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
const { problem } = actions
const [count, setCount] = useState(0) //
// const [search, setSearch] = useState({})
const [checkAll, setCheckAll] = useState(true) //
const api = useRef();
const search = useRef({
state: '', keywordTarget: '', keyword: '', kindId: '', groupUnitId: '',
@ -123,7 +121,8 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
useEffect(() => {
if (location) {
search.current = { ...search.current, ...location }
search.current = { ...search.current, ...location, state: 'new' }
api.current?.setValues({...location, state: 'new'})
}
if (route !== 'videoAbnormal' && route !== 'useAbnormal') {
dispatch(problem.getAlarmDataGroup()).then((res) => {
@ -157,7 +156,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
}
}, [])
console.log(location);
return (
<>

8
web/client/src/sections/problem/containers/dataAlarm.jsx

@ -128,10 +128,10 @@ const DataAlarm = (props) => {
{ name: '元素异常', value: 'element' }]
},
{
name: '异常状态', field: 'confirmState',
name: '异常状态', field: 'state',
data: [
{ name: '当前', value: 'unconfirmed' },
{ name: '历史', value: 'confirmd' }]
{ name: '当前', value: 'new' },
{ name: '历史', value: 'histroy' }]
}],
deviceAbnormal: [ // (deviceAbnormal)
{ name: '搜索', field: '1' },
@ -280,7 +280,7 @@ const DataAlarm = (props) => {
},
{ name: '位置信息', sort: 11, value: 'station', render: (_, r, index) => route == 'deviceAbnormal' ? r.station : r.station?.length > 0 ? r.station?.map(v => <div key={v.resolve + v.id} style={{ lineHeight: "22px" }}>{v.position}</div>) : "无" },
{
name: '设备类型', sort: 6, value: 'cameraKindId',
name: '设备类型', sort: 6, value: 'cameraKindId', render: (_, r, index) => r.cameraKindId || '其他',
},
{ name: '设备厂家', sort: 10, value: 'venderName', render: (_, r, index) => r.platform ? '未知' : r.venderName },
{ name: '通道号', sort: 10.1, value: 'cameraChannelNo' },

2
web/client/src/sections/service/containers/emPush.jsx

@ -513,7 +513,7 @@ const EmPush = (props) => {
dataIndex: "pushCount",
key: "pushCount",
render: (_, r, index) => {
return r.pushCount + '次'
return (r.pushCount||0) + '次'
},
},
];

Loading…
Cancel
Save