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. 6
      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. 4
      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 moment = require('moment')
const { alarmConfirmLog } = require('./alarmConfirmLog'); const { alarmConfirmLog } = require('./alarmConfirmLog');
async function inspection(ctx) { async function inspection (ctx) {
// 巡查 // 巡查
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
@ -31,7 +31,7 @@ async function inspection(ctx) {
} }
} }
async function inspectionList(ctx) { async function inspectionList (ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { clickHouse } = ctx.app.fs const { clickHouse } = ctx.app.fs
@ -116,7 +116,7 @@ async function inspectionList(ctx) {
} }
} }
async function notedInspection(ctx) { async function notedInspection (ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { inspectionId } = ctx.request.body const { inspectionId } = ctx.request.body
@ -141,7 +141,7 @@ async function notedInspection(ctx) {
} }
} }
async function apiError(ctx) { async function apiError (ctx) {
try { try {
const { utils: { sendAppearToWeb } } = ctx.app.fs const { utils: { sendAppearToWeb } } = ctx.app.fs
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
@ -253,12 +253,12 @@ async function apiError(ctx) {
} }
} }
async function apiErrorList(ctx) { async function apiErrorList (ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { clickHouse } = ctx.app.fs const { clickHouse } = ctx.app.fs
const { utils: { anxinStrucIdRange, pomsProjectRange } } = 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({ let pomsProject = await pomsProjectRange({
ctx, pepProjectId, ctx, pepProjectId,
@ -311,10 +311,10 @@ async function apiErrorList(ctx) {
if (errType) { if (errType) {
findOption.where.type = errType // element / apiError findOption.where.type = errType // element / apiError
} }
if (confirmState) { if (confirmState || state) {
if (confirmState == 'confirmd') { if (confirmState == 'confirmd' || state == 'histroy') {
findOption.where.confirmTime = { $ne: null } findOption.where.confirmTime = { $ne: null }
} else if (confirmState == 'unconfirmed') { } else if (confirmState == 'unconfirmed' || state == 'new') {
findOption.where.confirmTime = null findOption.where.confirmTime = null
} }
} }
@ -365,7 +365,7 @@ async function apiErrorList(ctx) {
} }
} }
async function confirmApiError(ctx) { async function confirmApiError (ctx) {
try { try {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { confirm, appAlarmId = [], confirmPost } = ctx.request.body 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 ctx, pepProjectId, keywordTarget, keyword
}) })
let whereOption = [] let whereOption = []
// ! 1 开发临时增加
if (anxinStruc.length) { if (anxinStruc.length) {
const anxinStrucIds = anxinStruc.map(a => a.strucId) const anxinStrucIds = anxinStruc.map(a => a.strucId)
// ! 开发临时注释
whereOption.push(`alarms.StructureId IN (${anxinStrucIds.join(",")})`) whereOption.push(`alarms.StructureId IN (${anxinStrucIds.join(",")})`)
if (groupId) { if (groupId) {

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

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

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

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

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

@ -34,7 +34,7 @@ async function list (ctx) {
if (keywordTarget == 'tactics') { if (keywordTarget == 'tactics') {
findOption.where.name = { $like: `%${keyword}%` } findOption.where.name = { $like: `%${keyword}%` }
} else if (keywordTarget == 'struc') { } else if (keywordTarget == 'struc') {
let bindAnixinStrucRes = await clickHouse.projectManage.query(` let bindAnixinStrucRes = await clickHouse.anxinyun.query(`
SELECT id, name FROM t_structure SELECT id, name FROM t_structure
WHERE name LIKE '%${keyword}%' WHERE name LIKE '%${keyword}%'
`).toPromise() `).toPromise()
@ -144,7 +144,7 @@ async function list (ctx) {
...p, ...p,
pomsProject: corBind, pomsProject: corBind,
structure: returnStruc, structure: returnStruc,
pushCount: corLogCount ? corLogCount.count : 0, pushCount: corLogCount ? corLogCount.dataValues.count : 0,
receiverPepUser: corReceiver receiverPepUser: corReceiver
}) })
} }
@ -185,7 +185,7 @@ async function edit (ctx) {
if (repeatRes) { if (repeatRes) {
throw `已有名称为[${name}]的同名策略` throw `已有名称为[${name}]的同名策略`
} }
if (pushId) { if (pushId) {
await models.AlarmPushConfig.update(storageData, { await models.AlarmPushConfig.update(storageData, {
where: { where: {

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

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

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

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

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

@ -139,6 +139,7 @@ function memberModal (props) {
style={{ width: 417 }} style={{ width: 417 }}
rules={[{ required: true, message: "请选择部门" }]} rules={[{ required: true, message: "请选择部门" }]}
showClear showClear
filter
initValue={departmentId || ""} initValue={departmentId || ""}
disabled={memberEdit} disabled={memberEdit}
> >
@ -157,6 +158,7 @@ function memberModal (props) {
<Form.Select <Form.Select
label="选择人员:" label="选择人员:"
field="pepUserId" field="pepUserId"
filter
placeholder="请选择人员" placeholder="请选择人员"
style={{ width: 417 }} style={{ width: 417 }}
rules={[{ required: true, message: "请选择人员" }]} rules={[{ required: true, message: "请选择人员" }]}
@ -208,6 +210,7 @@ function memberModal (props) {
placeholder="请选择关联项目" placeholder="请选择关联项目"
initValue={anxincloudArr} initValue={anxincloudArr}
style={{ width: 417 }} style={{ width: 417 }}
filter
showClear 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) => {// dispatch(install.getProjectAppList(query)).then((res) => {//
setAppList(res.payload.data) setAppList(res.payload.data)
}) })
console.log('user',user);
}, []) }, [])
useEffect(() => { useEffect(() => {
getProjectPomsList(); 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 { problem } = actions
const [count, setCount] = useState(0) // const [count, setCount] = useState(0) //
// const [search, setSearch] = useState({})
const [checkAll, setCheckAll] = useState(true) // const [checkAll, setCheckAll] = useState(true) //
const api = useRef(); const api = useRef();
const search = useRef({ const search = useRef({
state: '', keywordTarget: '', keyword: '', kindId: '', groupUnitId: '', state: '', keywordTarget: '', keyword: '', kindId: '', groupUnitId: '',
@ -123,7 +121,8 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
useEffect(() => { useEffect(() => {
if (location) { 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') { if (route !== 'videoAbnormal' && route !== 'useAbnormal') {
dispatch(problem.getAlarmDataGroup()).then((res) => { dispatch(problem.getAlarmDataGroup()).then((res) => {
@ -157,7 +156,7 @@ const TableData = ({ route, dispatch, actions, collectData, setSetup, exhibition
} }
}, []) }, [])
console.log(location);
return ( return (
<> <>

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

@ -128,10 +128,10 @@ const DataAlarm = (props) => {
{ name: '元素异常', value: 'element' }] { name: '元素异常', value: 'element' }]
}, },
{ {
name: '异常状态', field: 'confirmState', name: '异常状态', field: 'state',
data: [ data: [
{ name: '当前', value: 'unconfirmed' }, { name: '当前', value: 'new' },
{ name: '历史', value: 'confirmd' }] { name: '历史', value: 'histroy' }]
}], }],
deviceAbnormal: [ // (deviceAbnormal) deviceAbnormal: [ // (deviceAbnormal)
{ name: '搜索', field: '1' }, { 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: 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, value: 'venderName', render: (_, r, index) => r.platform ? '未知' : r.venderName },
{ name: '通道号', sort: 10.1, value: 'cameraChannelNo' }, { name: '通道号', sort: 10.1, value: 'cameraChannelNo' },

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

@ -188,7 +188,7 @@ const EmPush = (props) => {
record.structure?.map((item, index) => { record.structure?.map((item, index) => {
return ( return (
<span key={index} style={{ <span key={index} style={{
marginRight: 5, padding: '1px 17px', color: '#0F7EFB', marginRight: 5, padding: '1px 17px', color: '#0F7EFB',
display: 'inline-block', marginBottom: 5 display: 'inline-block', marginBottom: 5
}}> }}>
{item.name} {item.name}
@ -513,7 +513,7 @@ const EmPush = (props) => {
dataIndex: "pushCount", dataIndex: "pushCount",
key: "pushCount", key: "pushCount",
render: (_, r, index) => { render: (_, r, index) => {
return r.pushCount + '次' return (r.pushCount||0) + '次'
}, },
}, },
]; ];

Loading…
Cancel
Save