From ba2b7596bf084bfcf5621ee832822b726e497faa Mon Sep 17 00:00:00 2001 From: wenlele Date: Wed, 9 Nov 2022 09:07:47 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E5=BC=82=E5=B8=B8&=E9=97=AE=E9=A2=98=20?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/alarm/app.js | 20 +++++++++---------- .../sections/problem/components/tableData.jsx | 7 +++---- .../sections/problem/containers/dataAlarm.jsx | 6 +++--- 3 files changed, 16 insertions(+), 17 deletions(-) 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/web/client/src/sections/problem/components/tableData.jsx b/web/client/src/sections/problem/components/tableData.jsx index 936512c..e49f91c 100644 --- a/web/client/src/sections/problem/components/tableData.jsx +++ b/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 ( <> diff --git a/web/client/src/sections/problem/containers/dataAlarm.jsx b/web/client/src/sections/problem/containers/dataAlarm.jsx index 7a56c0f..716bab9 100644 --- a/web/client/src/sections/problem/containers/dataAlarm.jsx +++ b/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' }, From 1c586c4e885652eb12dfa1a726c3d2f9987cf412 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 9 Nov 2022 09:08:48 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/schedule/alarms_push.js | 2 ++ 1 file changed, 2 insertions(+) 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, }] }] }) From 014c9e3195eb6f4f5ee10e75981fa3e03dd22505 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 9 Nov 2022 11:00:12 +0800 Subject: [PATCH 3/8] bindAnixinStrucRes anxinyun --- api/app/lib/controllers/alarm/data.js | 2 -- api/app/lib/controllers/push/config.js | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) 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/push/config.js b/api/app/lib/controllers/push/config.js index f9fdfb2..5308865 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() From efe61c4e7b46220af518354a16a0466a1905e4d6 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 9 Nov 2022 11:08:00 +0800 Subject: [PATCH 4/8] bindAnixinStrucRes anxinyun --- api/app/lib/controllers/push/config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/app/lib/controllers/push/config.js b/api/app/lib/controllers/push/config.js index 5308865..0566837 100644 --- a/api/app/lib/controllers/push/config.js +++ b/api/app/lib/controllers/push/config.js @@ -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: { From c8167edcd6884f41feb1cb2599059bc24697c91e Mon Sep 17 00:00:00 2001 From: wenlele Date: Wed, 9 Nov 2022 11:08:16 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E6=9D=83?= =?UTF-8?q?=E9=99=90=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/organization/index.js | 7 +- .../src/sections/install/containers/roles.jsx | 1215 +++++++++-------- 2 files changed, 615 insertions(+), 607 deletions(-) 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/web/client/src/sections/install/containers/roles.jsx b/web/client/src/sections/install/containers/roles.jsx index 95a0f86..fff1b65 100644 --- a/web/client/src/sections/install/containers/roles.jsx +++ b/web/client/src/sections/install/containers/roles.jsx @@ -8,630 +8,633 @@ import MemberModal from '../components/memberModal'; import '../style.less' const Roles = (props) => { - const { dispatch, actions, user, loading, socket } = props - const { install } = actions; - const [roleAssignment, setRoleAssignment] = useState([])//角色分配 - const [roleChoose, setRoleChoose] = useState('')//角色选择 - const [query, setQuery] = useState({ limit: 10, page: 0 }); //页码信息 - const [adminModal, setAdminModal] = useState(false);//管理员弹框 - const [adminEdit, setAdminEdit] = useState(false);//管理员弹框是否修改 - const [editObj, setEditObj] = useState({});//管理员弹框修改内容 - const [memberModal, setMemberModal] = useState(false);//成员弹框 - const [memberEdit, setMemberEdit] = useState(false);//成员弹框是否修改 - const [anxincloudArr, setAnxincloudArr] = useState([]) //修改时已经选择的安心云列表 - const [anxinDelete, setAnxinDelete] = useState([]) //修改时安心云项目有删除,显示提示信息 + const { dispatch, actions, user, loading, socket } = props + const { install } = actions; + const [roleAssignment, setRoleAssignment] = useState([])//角色分配 + const [roleChoose, setRoleChoose] = useState('')//角色选择 + const [query, setQuery] = useState({ limit: 10, page: 0 }); //页码信息 + const [adminModal, setAdminModal] = useState(false);//管理员弹框 + const [adminEdit, setAdminEdit] = useState(false);//管理员弹框是否修改 + const [editObj, setEditObj] = useState({});//管理员弹框修改内容 + const [memberModal, setMemberModal] = useState(false);//成员弹框 + const [memberEdit, setMemberEdit] = useState(false);//成员弹框是否修改 + const [anxincloudArr, setAnxincloudArr] = useState([]) //修改时已经选择的安心云列表 + const [anxinDelete, setAnxinDelete] = useState([]) //修改时安心云项目有删除,显示提示信息 - const [columns, setColumns] = useState([//表格属性 - { - title: '成员', - render: (_, row) => { - let departmentsArr = [] - for (let i = 0; i < row.departments.length; i++) { - departmentsArr.push(row.departments[i].name) - } - return ( -
-
- {row.name} -
-
- {row?.departments[0]?.name || ''} -
- { - row.departments.length > 1 ? ( - -
- +{row.departments.length - 1} -
-
- ) : ('') - } -
- ) - } - }, - { - title: '项目名称', - render: (_, row) => { - let anxinerror = false - let anxinerrorArr = [] - for (let i = 0; i < row.correlationProject.length; i++) { - if (row.correlationProject[i].del == true) { - anxinerror = true - anxinerrorArr.push(row.correlationProject[i].pepProjectName) - } - } - return ( -
- { - anxinerror ? ( - -
- -
-
) : ('') - } - { - row.correlationProject.map((item, index) => { - return ( -
- { - row?.correlationProject?.length >= 3 ? ( - -
7 || item?.name?.length > 7 ? '112px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: index > 2 ? 'none' : '', color: item.del ? '#F93920' : '' }}> - {item.pepProjectName || item.name} -
-
- ) : row?.correlationProject?.length == 2 ? ( - -
12 || item?.name?.length > 12 ? '173.5px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', color: item.del ? '#F93920' : '' }}> - {item.pepProjectName || item.name} -
-
- ) : ( - -
25 || item?.name?.length > 25 ? '358px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', color: item.del ? '#F93920' : '' }}> - {item.pepProjectName || item.name} -
-
- ) - } -
1 ? 'none' : '' }}>
-
- ) - }) - } - { - row?.correlationProject?.length > 3 ? ( - - { - row.correlationProject.map((item, index) => { - return ( -
- {item.pepProjectName || item.name}, -
- ) - }) - } -
- } trigger="click" style={{ lineHeight: 2 }}> -
- +{row?.correlationProject?.length - 3} -
- - ) : ('') - } - - ) - } - }, - { - title: ( -
- 数据分析师 - - - -
- ), - render: (_, row) => { - let rolearr = row.role - return ( -
- { - rolearr.indexOf('data_analyst') != -1 ? ( -
-
- -
-
有权限
-
- ) : ( -
-
- -
-
无权限
-
- ) - } -
- ); - } - }, { - title: ( -
- 售后运维 - - - -
- ), - render: (_, row) => { - let rolearr = row.role - return ( -
- { - rolearr.indexOf('after_sale') != -1 ? ( -
-
- -
-
有权限
-
- ) : ( -
-
- -
-
无权限
-
- ) - } -
- ); + const [columns, setColumns] = useState([//表格属性 + { + title: '成员', + render: (_, row) => { + let departmentsArr = [] + for (let i = 0; i < row.departments.length; i++) { + departmentsArr.push(row.departments[i].name) } - }, { - title: ( -
- 资源管理者 - - - -
- ), - render: (_, row) => { - let rolearr = row.role - return ( -
- { - rolearr.indexOf('resource_manage') != -1 ? ( -
-
- -
-
有权限
-
- ) : ( -
-
- -
-
无权限
-
- ) - } -
- ); + return ( +
+
+ {row.name} +
+
+ {row?.departments[0]?.name || ''} +
+ { + row.departments.length > 1 ? ( + +
+ +{row.departments.length - 1} +
+
+ ) : ('') + } +
+ ) + } + }, + { + title: '项目名称', + render: (_, row) => { + let anxinerror = false + let anxinerrorArr = [] + for (let i = 0; i < row.correlationProject.length; i++) { + if (row.correlationProject[i].del == true) { + anxinerror = true + anxinerrorArr.push(row.correlationProject[i].pepProjectName) + } } - }, { - title: ( -
- 客户服务 - - - -
- ), - render: (_, row) => { - let rolearr = row.role - return ( -
- { - rolearr.indexOf('customer_service') != -1 ? ( -
-
- -
-
有权限
-
- ) : ( -
-
- -
-
无权限
-
- ) + return ( +
+ { + anxinerror ? ( + +
+ +
+
) : ('') + } + { + row.correlationProject.map((item, index) => { + return ( +
+ { + row?.correlationProject?.length >= 3 ? ( + +
7 || item?.name?.length > 7 ? '112px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: index > 2 ? 'none' : '', color: item.del ? '#F93920' : '' }}> + {item.pepProjectName || item.name} +
+
+ ) : row?.correlationProject?.length == 2 ? ( + +
12 || item?.name?.length > 12 ? '173.5px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', color: item.del ? '#F93920' : '' }}> + {item.pepProjectName || item.name} +
+
+ ) : ( + +
25 || item?.name?.length > 25 ? '358px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', color: item.del ? '#F93920' : '' }}> + {item.pepProjectName || item.name} +
+
+ ) + } +
1 ? 'none' : '' }}>
+
+ ) + }) + } + { + row?.correlationProject?.length > 3 ? ( + + { + row.correlationProject.map((item, index) => { + return ( +
+ {item.pepProjectName || item.name}, +
+ ) + }) + } +
+ } trigger="click" style={{ lineHeight: 2 }}> +
+ +{row?.correlationProject?.length - 3} +
+ + ) : ('') + } +
+ ) + } + }, + { + title: ( +
+ 数据分析师 + + + +
+ ), + render: (_, row) => { + let rolearr = row.role + return ( +
+ { + rolearr.indexOf('data_analyst') != -1 ? ( +
+
+ +
+
有权限
+
+ ) : ( +
+
+ +
+
无权限
+
+ ) + } +
+ ); + } + }, { + title: ( +
+ 售后运维 + + + +
+ ), + render: (_, row) => { + let rolearr = row.role + return ( +
+ { + rolearr.indexOf('after_sale') != -1 ? ( +
+
+ +
+
有权限
+
+ ) : ( +
+
+ +
+
无权限
+
+ ) + } +
+ ); + } + }, { + title: ( +
+ 资源管理者 + + + +
+ ), + render: (_, row) => { + let rolearr = row.role + return ( +
+ { + rolearr.indexOf('resource_manage') != -1 ? ( +
+
+ +
+
有权限
+
+ ) : ( +
+
+ +
+
无权限
+
+ ) + } +
+ ); + } + }, { + title: ( +
+ 客户服务 + + + +
+ ), + render: (_, row) => { + let rolearr = row.role + return ( +
+ { + rolearr.indexOf('customer_service') != -1 ? ( +
+
+ +
+
有权限
+
+ ) : ( +
+
+ +
+
无权限
+
+ ) + } +
+ ); + } + }, + { + title: "管理", + width: "20%", + dataIndex: "", + render: (_, row) => { + return ( +
+ {row?.disabled ? ( + + ) : ( + { + dispatch(install.putOrganizationUser({ pomsUserId: row?.id, disabled: !row?.disabled, msg: '更新成员状态' })).then(() => { + setQuery({ limit: 10, page: page.current }) + }) + }} + > + + + )} +
- ); - } - }, - { - title: "管理", - width: "20%", - dataIndex: "", - render: (_, row) => { - return ( -
- {row?.disabled ? ( - - ) : ( - { - dispatch(install.putOrganizationUser({ pomsUserId: row?.id, disabled: !row?.disabled, msg: '更新成员状态' })).then(() => { - setQuery({ limit: 10, page: page.current }) - }) - }} - > - - - )} - - { - dispatch(install.putOrganizationUser({ pomsUserId: row?.id, deleted: true, msg: '删除成员' })).then(() => { - if (page.current > 0 && mylimits.current < 2) { - setQuery({ limit: 10, page: page.current - 1 }) - } else { - setQuery({ limit: 10, page: page.current }) - } - }) - }} - > - - -
- ); - }, - }, - ]) - // const [data, setdata] = useState([])//表格数据 - const tableData = useRef([]); //表格数据 - const page = useRef(query.page);//哪一页 - const [limits, setLimits] = useState()//每页实际条数 - const mylimits = useRef(); //每页实际条数 - const [pepList, setPepList] = useState([])//角色分配 - const [pomsList, setPomsList] = useState([])//已绑定项目列表 - useEffect(() => { - getUserList(); - }, [query, roleChoose]); - useEffect(() => { - dispatch(install.getOrganizationDeps()).then((res) => {//获取项企(PEP)全部部门及其下用户 - setPepList(res.payload.data) - }) - dispatch(install.getProjectPoms()).then((res) => {//获取已绑定项目 - if (res.success) { - setPomsList(res.payload.data.rows) + setAnxinDelete(anxinErrorList) + setAnxincloudArr(myanxinArr) + setMemberModal(true); + setEditObj(row) + setMemberEdit(true) + }} + > + 编辑 + + { + dispatch(install.putOrganizationUser({ pomsUserId: row?.id, deleted: true, msg: '删除成员' })).then(() => { + if (page.current > 0 && mylimits.current < 2) { + setQuery({ limit: 10, page: page.current - 1 }) + } else { + setQuery({ limit: 10, page: page.current }) + } + }) + }} + > + + + + ); + }, + }, + ]) + // const [data, setdata] = useState([])//表格数据 + const tableData = useRef([]); //表格数据 + const page = useRef(query.page);//哪一页 + const [limits, setLimits] = useState()//每页实际条数 + const mylimits = useRef(); //每页实际条数 + const [pepList, setPepList] = useState([])//角色分配 + const [pomsList, setPomsList] = useState([])//已绑定项目列表 + + const userAdmin = user?.pomsUserInfo?.role.includes('admin') //判断当前用户是否为管理员 + useEffect(() => { + getUserList(); + }, [query, roleChoose]); + useEffect(() => { + dispatch(install.getOrganizationDeps()).then((res) => {//获取项企(PEP)全部部门及其下用户 + setPepList(res.payload.data) + }) + dispatch(install.getProjectPoms()).then((res) => {//获取已绑定项目 + if (res.success) { + setPomsList(res.payload.data.rows) + } + }) + }, []) + function getUserList () { + let searchData = { ...query, role: roleChoose } + dispatch(install.getOrganizationUser(searchData)).then((res) => {//获取成员列表 + if (res.success) { + tableData.current = res.payload.data.users.rows; + let notCreatedArr = [] + let notCreatedNum = 5 - res.payload.data.admin.length + for (let i = 0; i < notCreatedNum; i++) { + notCreatedArr.push('') } - }) - }, []) - function getUserList () { - let searchData = { ...query, role: roleChoose } - dispatch(install.getOrganizationUser(searchData)).then((res) => {//获取成员列表 - if (res.success) { - tableData.current = res.payload.data.users.rows; - let notCreatedArr = [] - let notCreatedNum = 5 - res.payload.data.admin.length - for (let i = 0; i < notCreatedNum; i++) { - notCreatedArr.push('') - } - setRoleAssignment(res.payload.data.admin.concat(notCreatedArr)) - setLimits(res.payload.data.users.count) - mylimits.current = res.payload.data.users.rows.length + if (userAdmin) notCreatedArr = [] + setRoleAssignment(res.payload.data.admin.concat(notCreatedArr)) + setLimits(res.payload.data.users.count) + mylimits.current = res.payload.data.users.rows.length + } + }) + } + function handleRow (record, index) {//斑马条纹 + // 给偶数行设置斑马纹 + if (index % 2 === 0) { + return { + style: { + background: '#FAFCFF', } - }) - } - function handleRow (record, index) {//斑马条纹 - // 给偶数行设置斑马纹 - if (index % 2 === 0) { - return { - style: { - background: '#FAFCFF', - } - }; - } else { - return {}; - } - } - function roleOnChange (e) {//角色选择 - setRoleChoose(e.target.value); - } - return ( - <> -
-
-
-
管理员设置
-
ADMINISTRATOR SETTING
-
-
-
平台最多支持5个管理员权限的关系绑定,该权限可对系统所有功能和项目进行设置和管理,包括系统权限、映射关系、工单配置等敏感操作,请谨慎使用该权限。
-
-
-
- { - roleAssignment.map((item, index) => { - return ( -
- { - item.id ? ( -
- { - item.departments?.map((itm, idx) => { - let mydepartmentsArr = [] - for (let index = 0; index < item.departments.length; index++) { - mydepartmentsArr.push(item.departments[index].name) - } - return ( -
3 ? 'none' : 'flex' - }}> - { - idx > 2 ? ( - -
- ... -
-
- - ) : ( - itm.name - ) - } -
- ) - }) - } -
- ) : ( -
+
+
+
+
管理员设置
+
ADMINISTRATOR SETTING
+
+
+
平台最多支持5个管理员权限的关系绑定,该权限可对系统所有功能和项目进行设置和管理,包括系统权限、映射关系、工单配置等敏感操作,请谨慎使用该权限。
+
+
+
+ { + roleAssignment.map((item, index) => { + return ( +
+ { + item.id ? ( +
+ { + item.departments?.map((itm, idx) => { + let mydepartmentsArr = [] + for (let index = 0; index < item.departments.length; index++) { + mydepartmentsArr.push(item.departments[index].name) + } + return ( +
3 ? 'none' : 'flex' }}> - 部门 + { + idx > 2 ? ( + +
+ ... +
+
+ + ) : ( + itm.name + ) + }
- ) - } -
-
-
- { - item.id ? ( -
{item.name}
- ) : ( -
虚席以待
- ) - } + ) + }) + } +
+ ) : ( +
+ 部门 +
+ ) + } +
+
+
+ { + item.id ? ( +
{item.name}
+ ) : ( +
虚席以待
+ ) + } -
{ - if (item.id) { - setEditObj(item) - setAdminEdit(true) - } - else { - setEditObj({}) - setAdminEdit(false) - } - setAdminModal(true) - }}> - -
- { - item.id ? ( - { - dispatch(install.deteleOrganizationAdmin({ id: item.id, msg: '删除管理员' })).then(() => getUserList()) - }} - > -
- -
-
+ {userAdmin ? "" : <>
{ + if (item.id) { + setEditObj(item) + setAdminEdit(true) + } + else { + setEditObj({}) + setAdminEdit(false) + } + setAdminModal(true) + }}> + +
+ { + item.id ? ( + { + dispatch(install.deteleOrganizationAdmin({ id: item.id, msg: '删除管理员' })).then(() => getUserList()) + }} + > +
+ +
+
- ) : ('') - } + ) : ('') + }} -
-
角色说明:拥有全平台的权限
-
-
- -
-
- ) - }) - } -
-
+
角色说明:拥有全平台的权限
+
+
+ +
+
+
+ ) + }) + } +
-
-
-
-
成员管理
-
MANAGEMENT OF MEMBERS
-
-
-
平台有4种类型的成员角色,分别是数据分析师、售后运维、资源管理者和客户服务,每名项目成员可拥有多种成员角色;
-
-
- - 全部 - 数据分析师 - 售后运维 - 资源管理者 - 客户服务 - -
-
- -
-
-
- - - -
- - 共{limits}条信息 - - { - setQuery({ limit: pageSize, page: currentPage - 1 }); - page.current = currentPage - 1 - }} - /> -
+ +
+
+
+
成员管理
+
MANAGEMENT OF MEMBERS
- {//管理员弹框 - adminModal ? - { - setAdminModal(false); +
+
平台有4种类型的成员角色,分别是数据分析师、售后运维、资源管理者和客户服务,每名项目成员可拥有多种成员角色;
+
+
+ + 全部 + 数据分析师 + 售后运维 + 资源管理者 + 客户服务 + +
+
+ +
+
+
+ +
+ +
+ + 共{limits}条信息 + + { + setQuery({ limit: pageSize, page: currentPage - 1 }); + page.current = currentPage - 1 + }} + /> +
+ + {//管理员弹框 + adminModal ? + { + setAdminModal(false); + }} + close={() => { + setAdminModal(false); + getUserList() + }} > + : '' + } + {//成员弹框 + memberModal ? + { + setMemberModal(false); + }} + close={() => { + setMemberModal(false); + getUserList() + }} > + : '' + } + + ) } function mapStateToProps (state) { - const { auth, global, OrganizationDeps } = state; - return { - loading: OrganizationDeps.isRequesting, - user: auth.user, - actions: global.actions, - // members: members.data, - }; + const { auth, global, OrganizationDeps } = state; + return { + loading: OrganizationDeps.isRequesting, + user: auth.user, + actions: global.actions, + // members: members.data, + }; } export default connect(mapStateToProps)(Roles); From a5d4fc1c67947ce1569a6b842f2e6ed7ab48e324 Mon Sep 17 00:00:00 2001 From: deartibers <947466799@qq.com> Date: Wed, 9 Nov 2022 11:08:31 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/sections/install/components/adminModal.jsx | 2 ++ web/client/src/sections/install/components/memberModal.jsx | 3 +++ web/client/src/sections/install/containers/system.jsx | 2 +- web/client/src/sections/service/containers/emPush.jsx | 4 ++-- 4 files changed, 8 insertions(+), 3 deletions(-) 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) { { diff --git a/web/client/src/sections/install/containers/system.jsx b/web/client/src/sections/install/containers/system.jsx index 69a80d1..79de903 100644 --- a/web/client/src/sections/install/containers/system.jsx +++ b/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(); diff --git a/web/client/src/sections/service/containers/emPush.jsx b/web/client/src/sections/service/containers/emPush.jsx index f8df1e4..2017936 100644 --- a/web/client/src/sections/service/containers/emPush.jsx +++ b/web/client/src/sections/service/containers/emPush.jsx @@ -188,7 +188,7 @@ const EmPush = (props) => { record.structure?.map((item, index) => { return ( {item.name} @@ -513,7 +513,7 @@ const EmPush = (props) => { dataIndex: "pushCount", key: "pushCount", render: (_, r, index) => { - return r.pushCount + '次' + return (r.pushCount||0) + '次' }, }, ]; From 69aad0c24d014036876f673101aa524bf700f900 Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 9 Nov 2022 14:30:37 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=91=8A=E8=AD=A6?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=AE=BE=E5=A4=87=E7=B1=BB=E5=9E=8B=EF=BC=8C?= =?UTF-8?q?=E6=97=A0=E7=B1=BB=E5=9E=8B=E6=88=96=E6=9C=AA=E5=A1=AB=E5=86=99?= =?UTF-8?q?=EF=BC=8C=E5=88=99=E9=BB=98=E8=AE=A4=E5=85=B6=E4=BB=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/client/src/sections/problem/containers/dataAlarm.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/client/src/sections/problem/containers/dataAlarm.jsx b/web/client/src/sections/problem/containers/dataAlarm.jsx index 716bab9..4f1ca61 100644 --- a/web/client/src/sections/problem/containers/dataAlarm.jsx +++ b/web/client/src/sections/problem/containers/dataAlarm.jsx @@ -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 =>
{v.position}
) : "无" }, { - 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' }, From 96b5724025d3ed9181ebdbb2acdb0d8eddf5282a Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Wed, 9 Nov 2022 16:06:45 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E8=A7=86=E9=A2=91=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=EF=BC=8C=E6=97=A0=E7=B1=BB=E5=9E=8B=E6=88=96?= =?UTF-8?q?=E6=9C=AA=E5=A1=AB=E5=86=99=EF=BC=8C=E5=88=99=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=85=B6=E4=BB=96=EF=BC=8C=E7=9B=B8=E5=85=B3=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/alarm/video.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) 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