diff --git a/api/.vscode/launch.json b/api/.vscode/launch.json index 7f1fd17..5e3848a 100644 --- a/api/.vscode/launch.json +++ b/api/.vscode/launch.json @@ -16,9 +16,9 @@ "-p 4600", "-f http://localhost:4600", // 研发 - // "-g postgres://postgres:123@10.8.30.32:5432/orational_service", + "-g postgres://postgres:123@10.8.30.32:5432/orational_service", // 测试 - "-g postgres://FashionAdmin:123456@10.8.30.156:5432/POMS", + // "-g postgres://FashionAdmin:123456@10.8.30.156:5432/POMS", "-k 10.8.30.72:29092,10.8.30.73:29092,10.8.30.74:29092", "--iotaProxy http://10.8.30.157:17007", "--redisHost 10.8.30.112", diff --git a/api/.vscode/settings.json b/api/.vscode/settings.json new file mode 100644 index 0000000..bc4fb95 --- /dev/null +++ b/api/.vscode/settings.json @@ -0,0 +1,6 @@ +// 将设置放入此文件中以覆盖默认值和用户设置。 +{ + "editor.fontSize": 16, + "eslint.format.enable": true, + "editor.tabSize": 3, +} \ No newline at end of file diff --git a/api/app/lib/controllers/alarm/data.js b/api/app/lib/controllers/alarm/data.js index a34e7d5..5a0cd53 100644 --- a/api/app/lib/controllers/alarm/data.js +++ b/api/app/lib/controllers/alarm/data.js @@ -13,7 +13,7 @@ async function groupList (ctx) { for (let g of groupRes) { g.unit = await await clickHouse.anxinyun.query(` - SELECT * FROM t_alarm_group_unit WHERE group_id = ${g.id} + SELECT * FROM t_alarm_group_unit WHERE group_id = ${g.id} `).toPromise(); } @@ -85,7 +85,7 @@ async function list (ctx) { whereOption.push(`DeviceStatus.Status = ${0}`) } } - + let alarmQueryOptionStr = ` FROM alarms diff --git a/api/app/lib/controllers/alarm/video.js b/api/app/lib/controllers/alarm/video.js index 95a2f3d..6a7cb55 100644 --- a/api/app/lib/controllers/alarm/video.js +++ b/api/app/lib/controllers/alarm/video.js @@ -28,7 +28,7 @@ async function alarmList (ctx) { const { clickHouse } = ctx.app.fs const { utils: { judgeSuper, anxinStrucIdRange } } = ctx.app.fs const { database: anxinyun } = clickHouse.anxinyun.opts.config - const { pepProjectId, keywordTarget, keyword, state, kindId, sustainTimeStart, sustainTimeEnd, limit, page, toExport } = ctx.query + const { pepProjectId, keywordTarget, keyword, state, kindId, sustainTimeStart, sustainTimeEnd, limit, page, statusId, toExport} = ctx.query let anxinStruc = await anxinStrucIdRange({ ctx, pepProjectId, keywordTarget, keyword @@ -72,6 +72,9 @@ async function alarmList (ctx) { ) `) } + if(statusId){ + statusAlarmWhereOption.push(`camera_status_alarm.status_id = ${statusId}`) + } const queryStr = ` SELECT diff --git a/api/app/lib/controllers/project/bind.js b/api/app/lib/controllers/project/bind.js index b93a1e0..06d25c2 100644 --- a/api/app/lib/controllers/project/bind.js +++ b/api/app/lib/controllers/project/bind.js @@ -7,7 +7,7 @@ async function bindAnxin2pep (ctx) { const models = ctx.fs.dc.models; const { clickHouse } = ctx.app.fs const { userId, pepUserId } = ctx.fs.api - const { bindId, name, pepProjectId, anxinProjectId = [], appId = [] } = ctx.request.body + const { bindId, name, pepProjectId, anxinProjectId = [], appId = [], mappingClass } = ctx.request.body if (name && pepProjectId) { throw '项企项目与自定义项目名称仅可选择一项' @@ -18,7 +18,7 @@ async function bindAnxin2pep (ctx) { let storageData = { name, pepProjectId, anxinProjectId, - updateTime: now, + updateTime: now, mappingClass, del: false, } @@ -111,6 +111,7 @@ async function bindAnxin2pep (ctx) { }, transaction }) + bindId_ = existRes.id } else { // 没有删除 重复添加 throw '当前项企项目已绑定' diff --git a/api/app/lib/controllers/project/index.js b/api/app/lib/controllers/project/index.js index 19acbd8..2659964 100644 --- a/api/app/lib/controllers/project/index.js +++ b/api/app/lib/controllers/project/index.js @@ -52,16 +52,39 @@ async function pomsProject (ctx) { let pepProjectIds = new Set() let anxinProjectIds = new Set() + let createUsers = new Set() for (let p of proRes.rows) { if (p.pepProjectId) { pepProjectIds.add(p.pepProjectId) } + if(p.createUser){ + createUsers.add(p.createUser) + } for (let ap of p.anxinProjectId) { if (ap) { anxinProjectIds.add(ap) } } } + const pomsUser = await models.User.findAll({ + where: { + id: { $in: [...createUsers]} + } + }) + let pepUserIds = new Set() + for (let p of pomsUser) { + if (p.pepUserId) { + pepUserIds.add(p.pepUserId) + } + } + const pepcaUser = pepUserIds.size ? + await clickHouse.pepEmis.query( + ` + SELECT * FROM user + WHERE id IN (${[...pepUserIds].join(',')}, -1) + ` + ).toPromise() : + [] const pepProjectRes = pepProjectIds.size ? await clickHouse.projectManage.query( ` @@ -89,6 +112,7 @@ async function pomsProject (ctx) { for (let p of proRes.rows) { const corPro = pepProjectRes.find(pp => pp.id == p.pepProjectId) || {} + const pepUserName = (pepcaUser.find(qq => qq.id == (pomsUser.find(oo => oo.id == p.createUser)||{}).pepUserId)||{}).name ||'' p.dataValues.pepProjectName = corPro.project_name p.dataValues.pepProjectIsDelete = corPro.isdelete p.dataValues.constructionStatusId = corPro.construction_status_id @@ -96,6 +120,7 @@ async function pomsProject (ctx) { let nextAnxinProject = anxinProjectRes.filter(ap => p.anxinProjectId.includes(ap.id)) p.dataValues.anxinProject = nextAnxinProject + p.dataValues.pepUserName = pepUserName delete p.dataValues.anxinProjectId } ctx.status = 200; diff --git a/api/app/lib/models/project_correlation.js b/api/app/lib/models/project_correlation.js index b0ae1be..b1b5990 100644 --- a/api/app/lib/models/project_correlation.js +++ b/api/app/lib/models/project_correlation.js @@ -78,6 +78,15 @@ module.exports = dc => { field: "update_time", autoIncrement: false }, + mappingClass: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "mapping_class", + autoIncrement: false + }, }, { tableName: "project_correlation", comment: "", diff --git a/script/0.0.9/schema/1.alter_project_correlation.sql b/script/0.0.9/schema/1.alter_project_correlation.sql new file mode 100644 index 0000000..37edd7b --- /dev/null +++ b/script/0.0.9/schema/1.alter_project_correlation.sql @@ -0,0 +1,4 @@ +alter table project_correlation + add mapping_class varchar(32); + +comment on column project_correlation.mapping_class is '映射分类参数 例如:智慧类:wisdom,监测类:monitor,其他:other'; diff --git a/web/client/src/sections/install/components/memberModal.jsx b/web/client/src/sections/install/components/memberModal.jsx index 72fb389..eeab3a4 100644 --- a/web/client/src/sections/install/components/memberModal.jsx +++ b/web/client/src/sections/install/components/memberModal.jsx @@ -1,6 +1,6 @@ import React, { useState, useRef, useEffect } from "react"; import { connect } from "react-redux"; -import { Modal, Form, CheckboxGroup, Checkbox } from "@douyinfe/semi-ui"; +import { Modal, Form, CheckboxGroup, Checkbox,Button } from "@douyinfe/semi-ui"; import { IconAlertCircle } from '@douyinfe/semi-icons'; @@ -42,6 +42,7 @@ function memberModal (props) { text: '拥有服务、工单、资料相关的权限' }, ]); //权限配置 + const [pomsList_, setPomsList_] = useState([]) //初始化 useEffect(() => { if (editObj.id) { @@ -54,6 +55,7 @@ function memberModal (props) { setDepartmentId(editObj.departments[0].id) setPeopleList(departmentList) } + setPomsList_(pomsList.filter(p=>p.pepProjectIsDelete != -1)) }, []); function handleOk () { @@ -212,15 +214,20 @@ function memberModal (props) { style={{ width: 417 }} filter showClear + outerBottomSlot={ +

+ +

+ } > { - pomsList.map((item, index) => { + pomsList_.map((item, index) => { return ( - item.pepProjectIsDelete !== 1 ? ( {item.pepProjectName || item.name} - ) : ('') ) }) } diff --git a/web/client/src/sections/install/components/systemModal.jsx b/web/client/src/sections/install/components/systemModal.jsx index b485c8f..48943f9 100644 --- a/web/client/src/sections/install/components/systemModal.jsx +++ b/web/client/src/sections/install/components/systemModal.jsx @@ -235,6 +235,29 @@ function adminModal (props) { }) } + + { + [ + { name: '智慧类', value: 'wisdom' }, + { name: '监测类', value: 'monitor' }, + { name: '其他', value: 'other' } + ].map(item => { + return + {item.name} + + }) + } + diff --git a/web/client/src/sections/install/containers/system.jsx b/web/client/src/sections/install/containers/system.jsx index c4f8fad..d0c83fe 100644 --- a/web/client/src/sections/install/containers/system.jsx +++ b/web/client/src/sections/install/containers/system.jsx @@ -231,6 +231,22 @@ const Example = (props) => { return moment(row.createTime).format("YYYY-MM-DD HH:mm:ss"); } }, + { + title: '修改时间', + dataIndex: "updateTime", + key: 'updateTime', + render: (_, row) => { + return moment(row.updateTime).format("YYYY-MM-DD HH:mm:ss"); + } + }, + { + title: '添加人员', + dataIndex: "pepUserName", + key: 'pepUserName', + render: (_, row) => { + return row.pepUserName + } + }, { title: "管理", width: "20%",