From 8b5f90272d25b08f24c9746bcda8d7813154c10e Mon Sep 17 00:00:00 2001 From: wenlele Date: Wed, 20 Dec 2023 08:39:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=A0=E5=B0=84=E4=B8=AD=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=B4=BE=E5=8D=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/project/bind.js | 14 +- api/app/lib/controllers/project/group.js | 8 +- api/app/lib/controllers/project/index.js | 87 ++++++++- api/app/lib/models/project_correlation.js | 45 +++++ api/app/lib/models/project_group.js | 11 +- api/app/lib/routes/project/index.js | 3 + ...> 1.update_alarm_data_continuity copy.sql} | 0 .../schema/2.update_project_correlation.sql | 5 + .../schema/3.update_project_group copy.sql | 25 +++ web/client/src/layout/actions/global.js | 1 + .../components/customProjGroupModal.jsx | 25 ++- .../src/layout/components/header/index.jsx | 8 +- web/client/src/layout/reducers/global.js | 4 +- .../src/sections/install/actions/system.js | 12 ++ .../install/components/systemModal.jsx | 179 +++++++++++++++--- .../sections/install/containers/system.jsx | 22 ++- web/client/src/utils/webapi.js | 1 + web/config.js | 9 +- web/package.json | 2 +- web/routes/attachment/index.js | 5 +- 20 files changed, 395 insertions(+), 71 deletions(-) rename script/4.1/schema/{1.update_alarm_data_continuity.sql => 1.update_alarm_data_continuity copy.sql} (100%) create mode 100644 script/4.1/schema/2.update_project_correlation.sql create mode 100644 script/4.1/schema/3.update_project_group copy.sql diff --git a/api/app/lib/controllers/project/bind.js b/api/app/lib/controllers/project/bind.js index a3f71fe..31a41f4 100644 --- a/api/app/lib/controllers/project/bind.js +++ b/api/app/lib/controllers/project/bind.js @@ -7,22 +7,24 @@ 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 = [], mappingClass,maintenancePeriod} = ctx.request.body + const { bindId, name, pepProjectId, anxinProjectId = [], appId = [], mappingClass, maintenancePeriod, + isanchor, sendorders, percentage, strucId, strucSensor + } = ctx.request.body if (name && pepProjectId) { throw '项企项目与自定义项目名称仅可选择一项' } let bindId_ = bindId const now = moment() - + let storageData = { name, pepProjectId, anxinProjectId, - updateTime: now, mappingClass, + updateTime: now, mappingClass, isanchor, sendorders, percentage, strucId, strucSensor, del: false, - maintenanceEnd:maintenancePeriod&&maintenancePeriod.length?maintenancePeriod[1]:null, - maintenanceStart:maintenancePeriod&&maintenancePeriod.length?maintenancePeriod[0]:null, + maintenanceEnd: maintenancePeriod && maintenancePeriod.length ? maintenancePeriod[1] : null, + maintenanceStart: maintenancePeriod && maintenancePeriod.length ? maintenancePeriod[0] : null, } - + // 仅限已有 pepProjectId 的项目 const existRes = pepProjectId ? await models.ProjectCorrelation.findOne({ where: Object.assign( diff --git a/api/app/lib/controllers/project/group.js b/api/app/lib/controllers/project/group.js index 0fdf51e..9443c06 100644 --- a/api/app/lib/controllers/project/group.js +++ b/api/app/lib/controllers/project/group.js @@ -49,7 +49,7 @@ async function editGroup (ctx) { try { const { models } = ctx.fs.dc; const { userId } = ctx.fs.api - const { id, name, pomsProjectIds = [] } = ctx.request.body + const { id, name, pomsProjectIds = [],percentage } = ctx.request.body if (!name || !pomsProjectIds || !pomsProjectIds.length) { throw '参数错误!' @@ -78,6 +78,7 @@ async function editGroup (ctx) { await models.ProjectGroup.update({ name, pomsProjectIds, + percentage }, { where: { id @@ -88,10 +89,7 @@ async function editGroup (ctx) { name, pomsProjectIds, pomsUserId: userId, - }, { - where: { - id - } + percentage }) } diff --git a/api/app/lib/controllers/project/index.js b/api/app/lib/controllers/project/index.js index 6c5526b..9d3c4ae 100644 --- a/api/app/lib/controllers/project/index.js +++ b/api/app/lib/controllers/project/index.js @@ -64,7 +64,7 @@ async function pomsProject (ctx) { WHERE project_name LIKE '%${keyword}%' ` ).toPromise() || [] - + const anxinProjectRes = await clickHouse.anxinyun.query( `SELECT id,"name", project_state AS projectState @@ -75,7 +75,7 @@ async function pomsProject (ctx) { let anxinProjectId = anxinProjectRes.map(v => v.id) findOption.where.$or = [ - { name: { $like: `%${keyword}%` } } ] + { name: { $like: `%${keyword}%` } }] if (projectId.length > 0) { findOption.where.$or.push({ pepProjectId: { $in: projectId } }) } @@ -132,7 +132,7 @@ async function pomsProject (ctx) { ` ).toPromise() : [] - + const pepProjectRes = pepProjectIds.size ? await clickHouse.projectManage.query( @@ -157,7 +157,7 @@ async function pomsProject (ctx) { const anxinProjectRes = anxinProjectIds.size ? await clickHouse.anxinyun.query(`SELECT id,"name",project_state AS projectState FROM t_project WHERE id IN (${[...anxinProjectIds].join(',')},-1)`).toPromise() : [] - + for (let p of proRes.rows) { const corPro = pepProjectRes.find(pp => pp.id == p.pepProjectId) || {} @@ -171,7 +171,7 @@ async function pomsProject (ctx) { p.dataValues.anxinProject = nextAnxinProject p.dataValues.pepUserName = pepUserName delete p.dataValues.anxinProjectId - p.dataValues.customerLevel=(pepmCustomerLevelRes.find(pp => pp.projectId == p.dataValues.pepProjectId)||{name:'--'}).name + p.dataValues.customerLevel = (pepmCustomerLevelRes.find(pp => pp.projectId == p.dataValues.pepProjectId) || { name: '--' }).name } ctx.status = 200; ctx.body = proRes @@ -388,6 +388,82 @@ async function strucWithPomsProject (ctx) { } } +async function getStructureStation (ctx) { + try { + const { models } = ctx.fs.dc; + const { clickHouse } = ctx.app.fs + const { projectId, traitLabel } = ctx.query + // projectId anxinyun 项目id + //traitLabel 重点关注 + let strucList = [] + let strucId = [] + + const StrucRes = projectId ? + await clickHouse.anxinyun.query( + ` + SELECT + t_structure.id AS strucId, + t_structure.name AS strucName + FROM + t_project_structure + LEFT JOIN + t_project + ON t_project.id = t_project_structure.project + LEFT JOIN + t_structure + ON t_structure.id = t_project_structure.structure + WHERE + t_project_structure.project IN (${projectId}) + ORDER BY strucId + ` + ).toPromise() : + [] + for (let s of StrucRes) { + if (!strucId.includes(s.strucId)) { + strucList.push(s) + strucId.push(s.strucId) + } + } + + let attention = `AND positionCaseInsensitive(toString(t_sensor.labels), ${traitLabel}) > 0` + + const sensor = strucId.length ? + await clickHouse.anxinyun.query( + ` + SELECT + t_sensor.id AS senterId, + t_sensor.name AS senterName, + t_factor.name AS factorName, + t_sensor.structure AS structure + FROM + t_sensor + LEFT JOIN + t_factor + ON t_factor.id = t_sensor.factor + WHERE + t_sensor.structure IN (${strucId.join(",")},-1) + ${traitLabel ? attention : null} + ORDER BY senterId + ` + ).toPromise() : + [] + + + for (let s of strucList) { + let findAll = sensor.filter(v => v.structure == s.strucId) || [] + s.sensor = findAll + } + + ctx.status = 200; + ctx.body = strucList + } catch (error) { + ctx.fs.logger.error(`path: ${ctx.path}, error: error`); + ctx.status = 400; + ctx.body = { + message: typeof error == 'string' ? error : undefined + } + } +} module.exports = { appList, projectAnxincloud, @@ -395,4 +471,5 @@ module.exports = { pomsProject, pepProjectConstrictionState, strucWithPomsProject, + getStructureStation }; \ No newline at end of file diff --git a/api/app/lib/models/project_correlation.js b/api/app/lib/models/project_correlation.js index 467b1ed..39e9de5 100644 --- a/api/app/lib/models/project_correlation.js +++ b/api/app/lib/models/project_correlation.js @@ -105,6 +105,51 @@ module.exports = dc => { field: "maintenance_end", autoIncrement: false }, + isanchor: { + type: DataTypes.BOOLEAN, + allowNull: true, + defaultValue: null, + comment: '是否续签', + primaryKey: false, + field: "isanchor", + autoIncrement: false + }, + sendorders: { + type: DataTypes.ARRAY(DataTypes.STRING), + allowNull: true, + defaultValue: null, + comment: '自动派单', + primaryKey: false, + field: "sendorders", + autoIncrement: false + }, + percentage: { + type: DataTypes.INTEGER, + allowNull: true, + defaultValue: null, + comment: '项目中断百分比', + primaryKey: false, + field: "percentage", + autoIncrement: false + }, + strucId: { + type: DataTypes.ARRAY(DataTypes.INTEGER), + allowNull: true, + defaultValue: null, + comment: '选中作为选择重点测点的结构物', + primaryKey: false, + field: "struc_id", + autoIncrement: false + }, + strucSensor: { + type: DataTypes.JSONB, + allowNull: true, + defaultValue: null, + comment: '选中对应结构的重点测点', + primaryKey: false, + field: "struc_sensor", + autoIncrement: false + }, }, { tableName: "project_correlation", comment: "", diff --git a/api/app/lib/models/project_group.js b/api/app/lib/models/project_group.js index 66a7336..9159fea 100644 --- a/api/app/lib/models/project_group.js +++ b/api/app/lib/models/project_group.js @@ -46,7 +46,16 @@ module.exports = dc => { key: "id", model: "user" } - } + }, + percentage: { + type: DataTypes.INTEGER, + allowNull: true, + defaultValue: null, + comment: null, + primaryKey: false, + field: "percentage", + autoIncrement: false, + }, }, { tableName: "project_group", comment: "", diff --git a/api/app/lib/routes/project/index.js b/api/app/lib/routes/project/index.js index 4201f7b..0033fde 100644 --- a/api/app/lib/routes/project/index.js +++ b/api/app/lib/routes/project/index.js @@ -29,6 +29,9 @@ module.exports = function (app, router, opts) { app.fs.api.logAttr['GET/project/structure'] = { content: '获取绑定项目下结构物', visible: true }; router.get('/project/structure', project.strucWithPomsProject); + app.fs.api.logAttr['GET/structure/station'] = { content: '获取对应结构物和重点测点', visible: true }; + router.get('/structure/station', project.getStructureStation); + // app.fs.api.logAttr['GET/project/group'] = { content: '获取项目分组', visible: true }; diff --git a/script/4.1/schema/1.update_alarm_data_continuity.sql b/script/4.1/schema/1.update_alarm_data_continuity copy.sql similarity index 100% rename from script/4.1/schema/1.update_alarm_data_continuity.sql rename to script/4.1/schema/1.update_alarm_data_continuity copy.sql diff --git a/script/4.1/schema/2.update_project_correlation.sql b/script/4.1/schema/2.update_project_correlation.sql new file mode 100644 index 0000000..02e3636 --- /dev/null +++ b/script/4.1/schema/2.update_project_correlation.sql @@ -0,0 +1,5 @@ +alter table project_group + add percentage int; + +comment on column project_group.percentage is '百分比'; + diff --git a/script/4.1/schema/3.update_project_group copy.sql b/script/4.1/schema/3.update_project_group copy.sql new file mode 100644 index 0000000..1555354 --- /dev/null +++ b/script/4.1/schema/3.update_project_group copy.sql @@ -0,0 +1,25 @@ +alter table project_correlation + add isanchor boolean; + +comment on column project_correlation.isanchor is '是否续签'; + +alter table project_correlation + add sendorders character varying[]; + +comment on column project_correlation.sendorders is '自动派单'; + +alter table project_correlation + add percentage int; + +comment on column project_correlation.percentage is '项目中断百分比'; + +alter table project_correlation + add struc_id integer[]; + +comment on column project_correlation.struc_id is '选中作为选择重点测点的结构物'; + +alter table project_correlation + add struc_sensor jsonb; + +comment on column project_correlation.struc_sensor is '选中对应结构的重点测点'; + diff --git a/web/client/src/layout/actions/global.js b/web/client/src/layout/actions/global.js index 8eb0d24..4f4934f 100644 --- a/web/client/src/layout/actions/global.js +++ b/web/client/src/layout/actions/global.js @@ -52,6 +52,7 @@ export function initApiRoot () { webOa: res.webOa, crawapi: res.crawapi, networkWeb: res.networkWeb, + traitLabel:res.traitLabel, } }) }); diff --git a/web/client/src/layout/components/header/components/customProjGroupModal.jsx b/web/client/src/layout/components/header/components/customProjGroupModal.jsx index 7969055..4be5d61 100644 --- a/web/client/src/layout/components/header/components/customProjGroupModal.jsx +++ b/web/client/src/layout/components/header/components/customProjGroupModal.jsx @@ -2,7 +2,7 @@ import React, { useEffect, useState, useRef } from 'react' import { connect, createStore } from "react-redux"; import Immutable from 'immutable'; -import { SplitButtonGroup, Dropdown, Button, Nav, Avatar, Input, useFormApi, Form, Modal } from '@douyinfe/semi-ui'; +import { SplitButtonGroup, Dropdown, Button, Nav, Avatar, Input, InputNumber, Form, Modal } from '@douyinfe/semi-ui'; import { IconTreeTriangleDown, IconSearch, IconPlus } from '@douyinfe/semi-icons'; import "../index.less"; @@ -41,15 +41,21 @@ const CustomProjGroupModal = (props) => { cancel() }} closeOnEsc={true} + width={560} > -
{ - form.current = formApi - if (editData) { - setTimeout(() => { - formApi.setValues(editData) - }, 0); - } - }}> + { + form.current = formApi + if (editData) { + setTimeout(() => { + formApi.setValues(editData) + }, 0); + } + }}> {({ formState, values, formApi }) => ( <> @@ -62,6 +68,7 @@ const CustomProjGroupModal = (props) => { }) } + )} diff --git a/web/client/src/layout/components/header/index.jsx b/web/client/src/layout/components/header/index.jsx index 55dc3fc..3b36325 100644 --- a/web/client/src/layout/components/header/index.jsx +++ b/web/client/src/layout/components/header/index.jsx @@ -13,7 +13,7 @@ import layout from '../../containers/layout'; let newScrollbar; const Header = (props) => { const { dispatch, history, user, actions, socket, headerItems, tochange, projectGroup } = props; - const { install, projectGroup: projectGroupAC, layout,problem } = actions + const { install, projectGroup: projectGroupAC, layout, problem } = actions const [pomsList, setPomsList] = useState([]) const [pomsName, setPomsName] = useState('全局') const [pepProjectId, setPepProjectId] = useState() @@ -227,15 +227,15 @@ const Header = (props) => { }} > { - v.name?.length > 10 ? + v.name?.length > 7 ? {v.name}}> - {v.name?.substr(0, 10)}... + {v.name?.substr(0, 7)}{v.percentage ? ("(" + v.percentage + "%)") : ""}... : - {v.name} + {v.name}{v.percentage ? ("(" + v.percentage + "%)") : ""} } diff --git a/web/client/src/layout/reducers/global.js b/web/client/src/layout/reducers/global.js index ab6c8d2..61c3b36 100644 --- a/web/client/src/layout/reducers/global.js +++ b/web/client/src/layout/reducers/global.js @@ -21,6 +21,7 @@ function global (state = { pomsNotebook: '', dcWeb: '', networkWeb: '', + traitLabel: '', crawapi: '', qiniu: {} }, action) { @@ -55,7 +56,8 @@ function global (state = { qiniu: payload.qiniu, webEmis: payload.webEmis, webOa: payload.webOa, - crawapi: payload.crawapi + crawapi: payload.crawapi, + traitLabel: payload.traitLabel, }).toJS(); case PEPPROJECTID: return Immutable.fromJS(state).merge({ diff --git a/web/client/src/sections/install/actions/system.js b/web/client/src/sections/install/actions/system.js index da4a446..036c44b 100644 --- a/web/client/src/sections/install/actions/system.js +++ b/web/client/src/sections/install/actions/system.js @@ -79,3 +79,15 @@ export function deleteProjectBind (data) {//删除安心云、项目管理项目 reducer: {}, }); } + +export function getStructureStation (query={}) {//获取对应结构物和重点测点 + return (dispatch) => basicAction({ + type: "get", + dispatch: dispatch, + actionType: "GET_STRUCTURE_STATION", + query: query, + url: `${ApiTable.getStructureStation}`, + msg: { option: "获取对应结构物和重点测点" }, + reducer: { name: "", params: { noClear: true } }, + }); +} diff --git a/web/client/src/sections/install/components/systemModal.jsx b/web/client/src/sections/install/components/systemModal.jsx index f15f8fd..7ea86e1 100644 --- a/web/client/src/sections/install/components/systemModal.jsx +++ b/web/client/src/sections/install/components/systemModal.jsx @@ -1,7 +1,7 @@ import React, { useState, useRef, useEffect } from "react"; import { connect } from "react-redux"; -import { Modal, Form, Tag } from "@douyinfe/semi-ui"; -import { IconAlertCircle } from '@douyinfe/semi-icons'; +import { Modal, Form, Tag, } from "@douyinfe/semi-ui"; +import { IconAlertCircle } from '@douyinfe/semi-icons'; function adminModal (props) { @@ -22,46 +22,95 @@ function adminModal (props) { appArr,//修改时添加应用 bindId, mapping, //修改时的映射类型 - maintenancePeriod //维保时间段 + maintenancePeriod, //维保时间段 + editData, + traitLabel } = props; const { install } = actions; const form = useRef();//表单 const [custom, setCustom] = useState(false); //是否是自定义项目 const [myprojectType, setMyprojectType] = useState('pep'); //是否是自定义项目 + const [structureSensor, setStructureSensor] = useState([]) + const [sendorders, setSendorders] = useState([]) + const [strucId, setStrucId] = useState([]) + //初始化 - useEffect(() => { + useEffect(async () => { if (pepname) { setCustom(true) setMyprojectType('axy') } + if (editData?.id) { + await getData({ projectId: anxincloudArr?.join(',') + ',-1' }) + setSendorders(editData?.sendorders) + if (editData?.sendorders?.includes('emphasis')) { + form.current.setValue('strucId', editData?.strucId) + editData?.strucId?.forEach(d => { + form.current.setValue('strucSensor' + d, editData?.strucSensor[d]) + + }) + setStrucId(editData?.strucId || []) + } + if (editData?.sendorders?.includes('percentage')) { + form.current.setValue('percentage', editData?.percentage) + } + + + } + }, []); + + + const getData = async (data = {}) => { + await dispatch(install.getStructureStation({ ...data, traitLabel })).then((res) => { + if (res.success) { + setStructureSensor(res.payload.data || []) + } + }) + } + function handleOk () { //点击弹框确定 右边按钮 form.current .validate() .then((values) => { + + let appArr = [] + for (let i = 0; i < values.appId.length; i++) { + appArr.push(JSON.parse(values.appId[i]).id) + } + console.log(22, values); + + let strucSensor = {} + if (values.sendorders?.includes("emphasis")) { + values.strucId?.forEach(d => { + strucSensor[d] = values['strucSensor' + d] || [] + }); + } + let data = { + name: values.name, + pepProjectId: values.pepProjectId, + anxinProjectId: values.anxinProjectId, + appId: appArr, + mappingClass: values.mappingClass, + maintenancePeriod: values.maintenancePeriod, + isanchor: values.isanchor, + sendorders: values.sendorders, + percentage: values.percentage, + strucId: values.strucId, + strucSensor: strucSensor + } + if (systemEdit) { - let appArr = [] - for (let i = 0; i < values.appId.length; i++) { - appArr.push(JSON.parse(values.appId[i]).id) - } - let bindObj = JSON.parse(JSON.stringify(values)) - bindObj.appId = appArr - dispatch(install.postProjectBind({ ...bindObj, bindId: bindId, msg: '修改映射关系' })).then((res) => {//获取项企(PEP)全部部门及其下用户 + dispatch(install.postProjectBind({ ...data, bindId: bindId, msg: '修改映射关系', })).then((res) => {//获取项企(PEP)全部部门及其下用户 if (res.success) { close(); } }) } else { - let appArr = [] - for (let i = 0; i < values.appId.length; i++) { - appArr.push(JSON.parse(values.appId[i]).id) - } - let bindObj = JSON.parse(JSON.stringify(values)) - bindObj.appId = appArr - dispatch(install.postProjectBind({ ...bindObj, msg: '添加映射关系' })).then((res) => {//获取项企(PEP)全部部门及其下用户 + dispatch(install.postProjectBind({ ...data, msg: '添加映射关系' })).then((res) => {//获取项企(PEP)全部部门及其下用户 if (res.success) { close(); } @@ -69,6 +118,8 @@ function adminModal (props) { } }) } + + function handleCancel () { cancel(); //点击弹框取消 左边按钮 @@ -86,6 +137,7 @@ function adminModal (props) { content }; } + return ( <> { for (var key in field) { if (key == 'projectType') { @@ -179,6 +231,15 @@ function adminModal (props) { rules={[{ required: true, message: "请选择安心云项目" }]} initValue={anxincloudArr || []} showClear + onChange={v => { + if (v.length) { + getData({ projectId: v.join(',') + ',-1' }) + } else { + setStructureSensor([]) + } + form.current.setValue('strucId', []) + setStrucId([]) + }} > { anxincloudList.map((item, index) => { @@ -245,7 +306,7 @@ function adminModal (props) { style={{ width: 425 }} initValue={mapping} showClear - > + > { [ { name: '智慧类', value: 'wisdom' }, @@ -261,18 +322,82 @@ function adminModal (props) { - - + + 续签 + 不续签 + + { + setSendorders(v) + if (!v.includes('emphasis')) { + setStrucId([]) + } + }} + > + 项目中断比例 + 重点点位监控 + + { + sendorders?.includes('percentage') && + + } + { + sendorders?.includes('emphasis') && + <> + { + setStrucId(v) + }} + > + { + structureSensor.map(item => { + return + {item.strucName} + + }) + } + + + {strucId?.length ? structureSensor?.filter(v => strucId?.includes(v.strucId))?.map((u, index) => { + return + { + u.sensor?.map((v, index) => + {v.senterName}({v.factorName})) + } + + }) : "" + } + + } - - + + ); } @@ -282,7 +407,7 @@ function mapStateToProps (state) { // loading: members.isRequesting, user: auth.user, actions: global.actions, - // members: members.data, + traitLabel: global.traitLabel, }; } diff --git a/web/client/src/sections/install/containers/system.jsx b/web/client/src/sections/install/containers/system.jsx index a012398..ebf5d97 100644 --- a/web/client/src/sections/install/containers/system.jsx +++ b/web/client/src/sections/install/containers/system.jsx @@ -29,8 +29,8 @@ const Example = (props) => { const page = useRef(query.page);//哪一页 const [mapping, setMapping] = useState() //修改时的映射类型 const [keyword, setKeyword] = useState() //搜索关键字 - const [maintenancePeriod,setMaintenancePeriod]=useState([])//维保时间区间 - + const [maintenancePeriod, setMaintenancePeriod] = useState([])//维保时间区间 + const [editData, setEditData] = useState({}) function handleRow (record, index) {//斑马条纹 @@ -194,14 +194,14 @@ const Example = (props) => { // // // ) - row.anxinProject.length >= 2 ? ( + row.anxinProject.length >= 2 ? ( -
4 ? '70px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: index > 2 ? 'none' : '', color: item.projectState == -1 ? '#F93920' : '' }}> +
4 ? '70px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: index > 2 ? 'none' : '', color: item.projectState == -1 ? '#F93920' : '' }}> {item.name}
- ):( + ) : ( -
7 ? '112px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: index > 2 ? 'none' : '', color: item.projectState == -1 ? '#F93920' : '' }}> +
7 ? '112px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: index > 2 ? 'none' : '', color: item.projectState == -1 ? '#F93920' : '' }}> {item.name}
) @@ -284,7 +284,7 @@ const Example = (props) => { dataIndex: "maintenanceStart", key: 'maintenanceStart', render: (_, row) => { - return row.maintenanceStart?moment(row.maintenanceStart).format('YYYY-MM-DD') : '无' + return row.maintenanceStart ? moment(row.maintenanceStart).format('YYYY-MM-DD') : '无' } }, { @@ -292,7 +292,7 @@ const Example = (props) => { dataIndex: "maintenanceEnd", key: 'maintenanceEnd', render: (_, row) => { - return row.maintenanceEnd?moment(row.maintenanceEnd).format('YYYY-MM-DD') : '无' + return row.maintenanceEnd ? moment(row.maintenanceEnd).format('YYYY-MM-DD') : '无' } }, { @@ -338,7 +338,8 @@ const Example = (props) => { setBindId(row.id) setMapping(row?.mappingClass) setSystemEdit(true) - setMaintenancePeriod([row?.maintenanceStart,row?.maintenanceEnd]) + setMaintenancePeriod([row?.maintenanceStart, row?.maintenanceEnd]) + setEditData(row) }} > 修改 @@ -530,14 +531,17 @@ const Example = (props) => { mapping={mapping} appArr={appArr} bindId={bindId} + editData={editData} maintenancePeriod={maintenancePeriod} cancel={() => { setSystemModal(false); + setEditData({}) }} close={() => { setSystemModal(false); getProjectPomsList() getPepProject() + setEditData({}) }} > : '' } diff --git a/web/client/src/utils/webapi.js b/web/client/src/utils/webapi.js index a4c2a5f..71f9815 100644 --- a/web/client/src/utils/webapi.js +++ b/web/client/src/utils/webapi.js @@ -35,6 +35,7 @@ export const ApiTable = { postProjectBind: 'project/bind',//绑定安心云、项目管理项目 getProjectAppList: 'project/app_list',//获取应用列表 deleteProjectBind: 'project/bind/{bindId}',//删除安心云、项目管理项目绑定关系 + getStructureStation: "structure/station",//获取对应结构物和重点测点 //项目分组 projectGroup: 'project/group', diff --git a/web/config.js b/web/config.js index 2990cef..81609e1 100644 --- a/web/config.js +++ b/web/config.js @@ -27,6 +27,7 @@ args.option('pomsEs', 'es监控 web'); args.option('pomsNotebook', 'notebook web'); args.option('dcWeb', '报表中心web'); args.option('networkWeb', '运维组网web'); +args.option('traitLabel', '映射关系里重点测点监控特征标签'); //硬件升级 args.option('crawapi', '硬件升级') @@ -56,6 +57,10 @@ const POMS_NOTEBOOK = process.env.POMS_NOTEBOOK || flags.pomsNotebook; const DC_WEB = process.env.DC_WEB || flags.dcWeb; const NETWORK_WEB = process.env.NETWORK_WEB || flags.networkWeb; const CRAW_API = process.env.CRAW_API || flags.crawapi; +//映射关系里重点测点监控特征标签 +const TRAIT_LABEL = process.env.TRAIT_LABEL || flags.traitLabel; + + // 七牛 const ANXINCLOUD_QINIU_AK = process.env.ANXINCLOUD_QINIU_ACCESSKEY || flags.qnak; const ANXINCLOUD_QINIU_SK = process.env.ANXINCLOUD_QINIU_SECRETKEY || flags.qnsk; @@ -63,6 +68,8 @@ const ANXINCLOUD_QINIU_BUCKET_RESOURCE = process.env.ANXINCLOUD_QINIU_BUCKET_RES const ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE = process.env.ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE || flags.qndmn; + + if ( !API_URL || !CRAW_API || !API_EMIS_URL || !WEB_EMIS_URL || !WEB_OA_URL @@ -125,7 +132,7 @@ const product = { networkWeb:NETWORK_WEB, staticRoot: './client', crawapi: CRAW_API, - + traitLabel:TRAIT_LABEL, qiniu: { fetchUrl: '/_file-server', domain: ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE diff --git a/web/package.json b/web/package.json index 84c90f5..d765bb2 100644 --- a/web/package.json +++ b/web/package.json @@ -7,7 +7,7 @@ "test": "mocha", "start-vite": "cross-env NODE_ENV=developmentVite npm run start-params", "start": "cross-env NODE_ENV=development npm run start-params", - "start-params": "node server -p 5600 -u http://localhost:4600 --networkWeb http://localhost:5000 --apiPomsUrl http://localhost:4600 --apiAnxinyunUrl http://10.8.30.112:4100 --apiEmisUrl http://localhost:14000 --webEmisUrl http://localhost:5000 --webOaUrl http://10.8.30.161:8668 --qnak 5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu --qnsk w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5 --qnbkt anxinyun-test --qndmn http://test.resources.anxinyun.cn --iotVcmpWeb https://mediaconsole.ngaiot.com --pomsMonitor http://monitor.anxinyun.cn/goto/PaEDLE84z?orgId=1 --pomsKubesphere https://ksboard.ngaiot.com/ --pomsAmbari https://ambari.anxinyun.cn/ --pomsKowl https://kafka.anxinyun.cn/ --pomsPghero https://pghero.anxinyun.cn/ --pomsEs https://esc.anxinyun.cn/ --pomsNotebook https://inotebook.anxinyun.cn/ --crawapi http://218.3.126.49:30555/v1 --dcWeb https://fsiot-oamss.anxinyun.cn", + "start-params": "node server -p 5600 -u http://localhost:4600 --traitLabel '重点测点' --networkWeb http://localhost:5000 --apiPomsUrl http://localhost:4600 --apiAnxinyunUrl http://10.8.30.112:4100 --apiEmisUrl http://localhost:14000 --webEmisUrl http://localhost:5000 --webOaUrl http://10.8.30.161:8668 --qnak 5XrM4wEB9YU6RQwT64sPzzE6cYFKZgssdP5Kj3uu --qnsk w6j2ixR_i-aelc6I7S3HotKIX-ukMzcKmDfH6-M5 --qnbkt anxinyun-test --qndmn http://test.resources.anxinyun.cn --iotVcmpWeb https://mediaconsole.ngaiot.com --pomsMonitor http://monitor.anxinyun.cn/goto/PaEDLE84z?orgId=1 --pomsKubesphere https://ksboard.ngaiot.com/ --pomsAmbari https://ambari.anxinyun.cn/ --pomsKowl https://kafka.anxinyun.cn/ --pomsPghero https://pghero.anxinyun.cn/ --pomsEs https://esc.anxinyun.cn/ --pomsNotebook https://inotebook.anxinyun.cn/ --crawapi http://218.3.126.49:30555/v1 --dcWeb https://fsiot-oamss.anxinyun.cn", "deploy": "export NODE_ENV=production&& npm run build && node server", "build-dev": "cross-env NODE_ENV=development&&webpack --config webpack.config.js", "build": "cross-env NODE_ENV=production&&webpack --config webpack.config.prod.js" diff --git a/web/routes/attachment/index.js b/web/routes/attachment/index.js index 0285e72..b47f62b 100644 --- a/web/routes/attachment/index.js +++ b/web/routes/attachment/index.js @@ -20,7 +20,7 @@ module.exports = { const getApiRoot = async function (ctx) { const { apiUrl, iotVcmpWeb, pomsMonitor, pomsKubesphere, pomsAmbari, pomsKowl, - pomsPghero, pomsEs, pomsNotebook, dcWeb, qiniu, webEmis, webOa, crawapi, networkWeb + pomsPghero, pomsEs, pomsNotebook, dcWeb, qiniu, webEmis, webOa, crawapi, networkWeb,traitLabel } = opts; ctx.status = 200; @@ -39,7 +39,8 @@ module.exports = { qiniu: qiniu, webEmis, webOa, - crawapi + crawapi, + traitLabel }; };