diff --git a/api/app/lib/controllers/alarm/app.js b/api/app/lib/controllers/alarm/app.js index 50afafd..5959423 100644 --- a/api/app/lib/controllers/alarm/app.js +++ b/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 diff --git a/api/app/lib/controllers/alarm/data.js b/api/app/lib/controllers/alarm/data.js index 13f42fd..a2cd793 100644 --- a/api/app/lib/controllers/alarm/data.js +++ b/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) { diff --git a/api/app/lib/controllers/alarm/video.js b/api/app/lib/controllers/alarm/video.js index 323c456..3c7a959 100644 --- a/api/app/lib/controllers/alarm/video.js +++ b/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 diff --git a/api/app/lib/controllers/organization/index.js b/api/app/lib/controllers/organization/index.js index 1007c06..5f11e55 100644 --- a/api/app/lib/controllers/organization/index.js +++ b/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: { diff --git a/api/app/lib/controllers/push/config.js b/api/app/lib/controllers/push/config.js index f9fdfb2..0566837 100644 --- a/api/app/lib/controllers/push/config.js +++ b/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 }) } @@ -185,7 +185,7 @@ async function edit (ctx) { if (repeatRes) { throw `已有名称为[${name}]的同名策略` } - + if (pushId) { await models.AlarmPushConfig.update(storageData, { where: { diff --git a/api/app/lib/schedule/alarms_push.js b/api/app/lib/schedule/alarms_push.js index 443ecac..57f8736 100644 --- a/api/app/lib/schedule/alarms_push.js +++ b/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, }] }] }) diff --git a/web/client/src/sections/install/components/adminModal.jsx b/web/client/src/sections/install/components/adminModal.jsx index 4417bac..262838a 100644 --- a/web/client/src/sections/install/components/adminModal.jsx +++ b/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} > { diff --git a/web/client/src/sections/install/components/memberModal.jsx b/web/client/src/sections/install/components/memberModal.jsx index 48b6808..72fb389 100644 --- a/web/client/src/sections/install/components/memberModal.jsx +++ b/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) {