Browse Source

映射中添加自动派单功能

dev
wenlele 1 year ago
parent
commit
8b5f90272d
  1. 10
      api/app/lib/controllers/project/bind.js
  2. 8
      api/app/lib/controllers/project/group.js
  3. 81
      api/app/lib/controllers/project/index.js
  4. 45
      api/app/lib/models/project_correlation.js
  5. 11
      api/app/lib/models/project_group.js
  6. 3
      api/app/lib/routes/project/index.js
  7. 0
      script/4.1/schema/1.update_alarm_data_continuity copy.sql
  8. 5
      script/4.1/schema/2.update_project_correlation.sql
  9. 25
      script/4.1/schema/3.update_project_group copy.sql
  10. 1
      web/client/src/layout/actions/global.js
  11. 11
      web/client/src/layout/components/header/components/customProjGroupModal.jsx
  12. 8
      web/client/src/layout/components/header/index.jsx
  13. 4
      web/client/src/layout/reducers/global.js
  14. 12
      web/client/src/sections/install/actions/system.js
  15. 169
      web/client/src/sections/install/components/systemModal.jsx
  16. 18
      web/client/src/sections/install/containers/system.jsx
  17. 1
      web/client/src/utils/webapi.js
  18. 9
      web/config.js
  19. 2
      web/package.json
  20. 5
      web/routes/attachment/index.js

10
api/app/lib/controllers/project/bind.js

@ -7,7 +7,9 @@ async function bindAnxin2pep (ctx) {
const models = ctx.fs.dc.models; const models = ctx.fs.dc.models;
const { clickHouse } = ctx.app.fs const { clickHouse } = ctx.app.fs
const { userId, pepUserId } = ctx.fs.api 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) { if (name && pepProjectId) {
throw '项企项目与自定义项目名称仅可选择一项' throw '项企项目与自定义项目名称仅可选择一项'
} }
@ -17,10 +19,10 @@ async function bindAnxin2pep (ctx) {
let storageData = { let storageData = {
name, pepProjectId, anxinProjectId, name, pepProjectId, anxinProjectId,
updateTime: now, mappingClass, updateTime: now, mappingClass, isanchor, sendorders, percentage, strucId, strucSensor,
del: false, del: false,
maintenanceEnd:maintenancePeriod&&maintenancePeriod.length?maintenancePeriod[1]:null, maintenanceEnd: maintenancePeriod && maintenancePeriod.length ? maintenancePeriod[1] : null,
maintenanceStart:maintenancePeriod&&maintenancePeriod.length?maintenancePeriod[0]:null, maintenanceStart: maintenancePeriod && maintenancePeriod.length ? maintenancePeriod[0] : null,
} }
// 仅限已有 pepProjectId 的项目 // 仅限已有 pepProjectId 的项目

8
api/app/lib/controllers/project/group.js

@ -49,7 +49,7 @@ async function editGroup (ctx) {
try { try {
const { models } = ctx.fs.dc; const { models } = ctx.fs.dc;
const { userId } = ctx.fs.api 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) { if (!name || !pomsProjectIds || !pomsProjectIds.length) {
throw '参数错误!' throw '参数错误!'
@ -78,6 +78,7 @@ async function editGroup (ctx) {
await models.ProjectGroup.update({ await models.ProjectGroup.update({
name, name,
pomsProjectIds, pomsProjectIds,
percentage
}, { }, {
where: { where: {
id id
@ -88,10 +89,7 @@ async function editGroup (ctx) {
name, name,
pomsProjectIds, pomsProjectIds,
pomsUserId: userId, pomsUserId: userId,
}, { percentage
where: {
id
}
}) })
} }

81
api/app/lib/controllers/project/index.js

@ -75,7 +75,7 @@ async function pomsProject (ctx) {
let anxinProjectId = anxinProjectRes.map(v => v.id) let anxinProjectId = anxinProjectRes.map(v => v.id)
findOption.where.$or = [ findOption.where.$or = [
{ name: { $like: `%${keyword}%` } } ] { name: { $like: `%${keyword}%` } }]
if (projectId.length > 0) { if (projectId.length > 0) {
findOption.where.$or.push({ pepProjectId: { $in: projectId } }) findOption.where.$or.push({ pepProjectId: { $in: projectId } })
} }
@ -171,7 +171,7 @@ async function pomsProject (ctx) {
p.dataValues.anxinProject = nextAnxinProject p.dataValues.anxinProject = nextAnxinProject
p.dataValues.pepUserName = pepUserName p.dataValues.pepUserName = pepUserName
delete p.dataValues.anxinProjectId 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.status = 200;
ctx.body = proRes 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 = { module.exports = {
appList, appList,
projectAnxincloud, projectAnxincloud,
@ -395,4 +471,5 @@ module.exports = {
pomsProject, pomsProject,
pepProjectConstrictionState, pepProjectConstrictionState,
strucWithPomsProject, strucWithPomsProject,
getStructureStation
}; };

45
api/app/lib/models/project_correlation.js

@ -105,6 +105,51 @@ module.exports = dc => {
field: "maintenance_end", field: "maintenance_end",
autoIncrement: false 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", tableName: "project_correlation",
comment: "", comment: "",

11
api/app/lib/models/project_group.js

@ -46,7 +46,16 @@ module.exports = dc => {
key: "id", key: "id",
model: "user" model: "user"
} }
} },
percentage: {
type: DataTypes.INTEGER,
allowNull: true,
defaultValue: null,
comment: null,
primaryKey: false,
field: "percentage",
autoIncrement: false,
},
}, { }, {
tableName: "project_group", tableName: "project_group",
comment: "", comment: "",

3
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 }; app.fs.api.logAttr['GET/project/structure'] = { content: '获取绑定项目下结构物', visible: true };
router.get('/project/structure', project.strucWithPomsProject); 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 }; app.fs.api.logAttr['GET/project/group'] = { content: '获取项目分组', visible: true };

0
script/4.1/schema/1.update_alarm_data_continuity.sql → script/4.1/schema/1.update_alarm_data_continuity copy.sql

5
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 '百分比';

25
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 '选中对应结构的重点测点';

1
web/client/src/layout/actions/global.js

@ -52,6 +52,7 @@ export function initApiRoot () {
webOa: res.webOa, webOa: res.webOa,
crawapi: res.crawapi, crawapi: res.crawapi,
networkWeb: res.networkWeb, networkWeb: res.networkWeb,
traitLabel:res.traitLabel,
} }
}) })
}); });

11
web/client/src/layout/components/header/components/customProjGroupModal.jsx

@ -2,7 +2,7 @@
import React, { useEffect, useState, useRef } from 'react' import React, { useEffect, useState, useRef } from 'react'
import { connect, createStore } from "react-redux"; import { connect, createStore } from "react-redux";
import Immutable from 'immutable'; 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 { IconTreeTriangleDown, IconSearch, IconPlus } from '@douyinfe/semi-icons';
import "../index.less"; import "../index.less";
@ -41,8 +41,14 @@ const CustomProjGroupModal = (props) => {
cancel() cancel()
}} }}
closeOnEsc={true} closeOnEsc={true}
width={560}
> >
<Form getFormApi={formApi => { <Form
wrapperCol={{ span: 16 }}
labelCol={{ span: 8 }}
labelPosition='left'
labelAlign='right'
getFormApi={formApi => {
form.current = formApi form.current = formApi
if (editData) { if (editData) {
setTimeout(() => { setTimeout(() => {
@ -62,6 +68,7 @@ const CustomProjGroupModal = (props) => {
}) })
} }
</Form.Select> </Form.Select>
<Form.InputNumber field='percentage' label='项目集中断百分比' min={0} max={100} />
</> </>
)} )}
</Form> </Form>

8
web/client/src/layout/components/header/index.jsx

@ -13,7 +13,7 @@ import layout from '../../containers/layout';
let newScrollbar; let newScrollbar;
const Header = (props) => { const Header = (props) => {
const { dispatch, history, user, actions, socket, headerItems, tochange, projectGroup } = 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 [pomsList, setPomsList] = useState([])
const [pomsName, setPomsName] = useState('全局') const [pomsName, setPomsName] = useState('全局')
const [pepProjectId, setPepProjectId] = useState() const [pepProjectId, setPepProjectId] = useState()
@ -227,15 +227,15 @@ const Header = (props) => {
}} }}
> >
{ {
v.name?.length > 10 ? v.name?.length > 7 ?
<Tooltip content={<div>{v.name}</div>}> <Tooltip content={<div>{v.name}</div>}>
<span > <span >
{v.name?.substr(0, 10)}... {v.name?.substr(0, 7)}{v.percentage ? ("(" + v.percentage + "%)") : ""}...
</span> </span>
</Tooltip> </Tooltip>
: :
<span > <span >
{v.name} {v.name}{v.percentage ? ("(" + v.percentage + "%)") : ""}
</span> </span>
} }
<Space style={{ float: 'right', position: 'relative', top: 3, }}> <Space style={{ float: 'right', position: 'relative', top: 3, }}>

4
web/client/src/layout/reducers/global.js

@ -21,6 +21,7 @@ function global (state = {
pomsNotebook: '', pomsNotebook: '',
dcWeb: '', dcWeb: '',
networkWeb: '', networkWeb: '',
traitLabel: '',
crawapi: '', crawapi: '',
qiniu: {} qiniu: {}
}, action) { }, action) {
@ -55,7 +56,8 @@ function global (state = {
qiniu: payload.qiniu, qiniu: payload.qiniu,
webEmis: payload.webEmis, webEmis: payload.webEmis,
webOa: payload.webOa, webOa: payload.webOa,
crawapi: payload.crawapi crawapi: payload.crawapi,
traitLabel: payload.traitLabel,
}).toJS(); }).toJS();
case PEPPROJECTID: case PEPPROJECTID:
return Immutable.fromJS(state).merge({ return Immutable.fromJS(state).merge({

12
web/client/src/sections/install/actions/system.js

@ -79,3 +79,15 @@ export function deleteProjectBind (data) {//删除安心云、项目管理项目
reducer: {}, 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 } },
});
}

169
web/client/src/sections/install/components/systemModal.jsx

@ -1,6 +1,6 @@
import React, { useState, useRef, useEffect } from "react"; import React, { useState, useRef, useEffect } from "react";
import { connect } from "react-redux"; import { connect } from "react-redux";
import { Modal, Form, Tag } from "@douyinfe/semi-ui"; import { Modal, Form, Tag, } from "@douyinfe/semi-ui";
import { IconAlertCircle } from '@douyinfe/semi-icons'; import { IconAlertCircle } from '@douyinfe/semi-icons';
@ -22,46 +22,95 @@ function adminModal (props) {
appArr,// appArr,//
bindId, bindId,
mapping, // mapping, //
maintenancePeriod // maintenancePeriod, //
editData,
traitLabel
} = props; } = props;
const { install } = actions; const { install } = actions;
const form = useRef();// const form = useRef();//
const [custom, setCustom] = useState(false); // const [custom, setCustom] = useState(false); //
const [myprojectType, setMyprojectType] = useState('pep'); // const [myprojectType, setMyprojectType] = useState('pep'); //
const [structureSensor, setStructureSensor] = useState([])
const [sendorders, setSendorders] = useState([])
const [strucId, setStrucId] = useState([])
// //
useEffect(() => { useEffect(async () => {
if (pepname) { if (pepname) {
setCustom(true) setCustom(true)
setMyprojectType('axy') 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 () { function handleOk () {
// //
form.current form.current
.validate() .validate()
.then((values) => { .then((values) => {
if (systemEdit) {
let appArr = [] let appArr = []
for (let i = 0; i < values.appId.length; i++) { for (let i = 0; i < values.appId.length; i++) {
appArr.push(JSON.parse(values.appId[i]).id) appArr.push(JSON.parse(values.appId[i]).id)
} }
let bindObj = JSON.parse(JSON.stringify(values)) console.log(22, values);
bindObj.appId = appArr
dispatch(install.postProjectBind({ ...bindObj, bindId: bindId, msg: '修改映射关系' })).then((res) => {//(PEP) 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) {
dispatch(install.postProjectBind({ ...data, bindId: bindId, msg: '修改映射关系', })).then((res) => {//(PEP)
if (res.success) { if (res.success) {
close(); close();
} }
}) })
} }
else { else {
let appArr = [] dispatch(install.postProjectBind({ ...data, msg: '添加映射关系' })).then((res) => {//(PEP)
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)
if (res.success) { if (res.success) {
close(); close();
} }
@ -69,6 +118,8 @@ function adminModal (props) {
} }
}) })
} }
function handleCancel () { function handleCancel () {
cancel(); cancel();
// //
@ -86,6 +137,7 @@ function adminModal (props) {
content content
}; };
} }
return ( return (
<> <>
<Modal <Modal
@ -106,7 +158,7 @@ function adminModal (props) {
allowEmpty allowEmpty
labelPosition="left" labelPosition="left"
labelAlign="right" labelAlign="right"
labelWidth="110px" labelWidth="132px"
onValueChange={(values, field) => { onValueChange={(values, field) => {
for (var key in field) { for (var key in field) {
if (key == 'projectType') { if (key == 'projectType') {
@ -179,6 +231,15 @@ function adminModal (props) {
rules={[{ required: true, message: "请选择安心云项目" }]} rules={[{ required: true, message: "请选择安心云项目" }]}
initValue={anxincloudArr || []} initValue={anxincloudArr || []}
showClear showClear
onChange={v => {
if (v.length) {
getData({ projectId: v.join(',') + ',-1' })
} else {
setStructureSensor([])
}
form.current.setValue('strucId', [])
setStrucId([])
}}
> >
{ {
anxincloudList.map((item, index) => { anxincloudList.map((item, index) => {
@ -261,18 +322,82 @@ function adminModal (props) {
<Form.DatePicker <Form.DatePicker
style={{ width: 425 }} style={{ width: 425 }}
label='维保期限时间:' label='维保期限时间:'
type={'dateRange'} type='dateRange'
field='maintenancePeriod' field='maintenancePeriod'
initValue={maintenancePeriod} initValue={maintenancePeriod}
> >
</Form.DatePicker> </Form.DatePicker>
</div> </div>
<Form.RadioGroup field="isanchor" label='是否续签:' initValue={editData?.isanchor} >
<Form.Radio value={true}>续签</Form.Radio>
<Form.Radio value={false}>不续签</Form.Radio>
</Form.RadioGroup>
<Form.CheckboxGroup
field="sendorders"
label='自动派单:'
direction='horizontal'
initValue={editData?.sendorders || []}
onChange={v => {
setSendorders(v)
if (!v.includes('emphasis')) {
setStrucId([])
}
}}
>
<Form.Checkbox value="percentage">项目中断比例</Form.Checkbox>
<Form.Checkbox value="emphasis">重点点位监控</Form.Checkbox>
</Form.CheckboxGroup>
{
sendorders?.includes('percentage') &&
<Form.InputNumber field='percentage' label='项目中断百分比:' min={0} max={100} />
}
{
sendorders?.includes('emphasis') &&
<>
<Form.Select
label="选择结构物:"
field="strucId"
filter
multiple
placeholder="请选择结构物"
style={{ width: 425 }}
// initValue={[]}
showClear
onChange={v => {
setStrucId(v)
}}
>
{
structureSensor.map(item => {
return <Form.Select.Option key={item.strucId} value={item.strucId}>
{item.strucName}
</Form.Select.Option>
})
}
</Form.Select>
{strucId?.length ? structureSensor?.filter(v => strucId?.includes(v.strucId))?.map((u, index) => {
return <Form.CheckboxGroup
label={u.strucName + ':'}
key={u.strucName + index}
field={'strucSensor' + u.strucId}
style={{ width: 420 }}
// initValue={editObj?.pomsStrucFactorId ? editObj?.pomsStrucFactorId[u.id] : (factorItem || [])}
direction='horizontal'
showClear
>
{
u.sensor?.map((v, index) =>
<Form.Checkbox value={v.senterId} key={v.senterId} style={{ width: 200 }}>{v.senterName}{v.factorName}</Form.Checkbox>)
}
</Form.CheckboxGroup>
}) : ""
}
</>
}
</Form> </Form>
</div> </div >
</Modal> </Modal >
</> </>
); );
} }
@ -282,7 +407,7 @@ function mapStateToProps (state) {
// loading: members.isRequesting, // loading: members.isRequesting,
user: auth.user, user: auth.user,
actions: global.actions, actions: global.actions,
// members: members.data, traitLabel: global.traitLabel,
}; };
} }

18
web/client/src/sections/install/containers/system.jsx

@ -29,8 +29,8 @@ const Example = (props) => {
const page = useRef(query.page);// const page = useRef(query.page);//
const [mapping, setMapping] = useState() // const [mapping, setMapping] = useState() //
const [keyword, setKeyword] = useState() // const [keyword, setKeyword] = useState() //
const [maintenancePeriod,setMaintenancePeriod]=useState([])// const [maintenancePeriod, setMaintenancePeriod] = useState([])//
const [editData, setEditData] = useState({})
function handleRow (record, index) {// function handleRow (record, index) {//
@ -199,9 +199,9 @@ const Example = (props) => {
<div style={{ width: item.name.length > 4 ? '70px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: index > 2 ? 'none' : '', color: item.projectState == -1 ? '#F93920' : '' }}> <div style={{ width: item.name.length > 4 ? '70px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: index > 2 ? 'none' : '', color: item.projectState == -1 ? '#F93920' : '' }}>
{item.name} {item.name}
</div> </div>
</Tooltip>):( </Tooltip>) : (
<Tooltip content={item.name}> <Tooltip content={item.name}>
<div style={{width: item.name.length > 7 ? '112px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: index > 2 ? 'none' : '', color: item.projectState == -1 ? '#F93920' : '' }}> <div style={{ width: item.name.length > 7 ? '112px' : '', whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis', display: index > 2 ? 'none' : '', color: item.projectState == -1 ? '#F93920' : '' }}>
{item.name} {item.name}
</div> </div>
</Tooltip>) </Tooltip>)
@ -284,7 +284,7 @@ const Example = (props) => {
dataIndex: "maintenanceStart", dataIndex: "maintenanceStart",
key: 'maintenanceStart', key: 'maintenanceStart',
render: (_, row) => { 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", dataIndex: "maintenanceEnd",
key: 'maintenanceEnd', key: 'maintenanceEnd',
render: (_, row) => { 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) setBindId(row.id)
setMapping(row?.mappingClass) setMapping(row?.mappingClass)
setSystemEdit(true) setSystemEdit(true)
setMaintenancePeriod([row?.maintenanceStart,row?.maintenanceEnd]) setMaintenancePeriod([row?.maintenanceStart, row?.maintenanceEnd])
setEditData(row)
}} }}
> >
修改 修改
@ -530,14 +531,17 @@ const Example = (props) => {
mapping={mapping} mapping={mapping}
appArr={appArr} appArr={appArr}
bindId={bindId} bindId={bindId}
editData={editData}
maintenancePeriod={maintenancePeriod} maintenancePeriod={maintenancePeriod}
cancel={() => { cancel={() => {
setSystemModal(false); setSystemModal(false);
setEditData({})
}} }}
close={() => { close={() => {
setSystemModal(false); setSystemModal(false);
getProjectPomsList() getProjectPomsList()
getPepProject() getPepProject()
setEditData({})
}} > }} >
</SystemModal> : '' </SystemModal> : ''
} }

1
web/client/src/utils/webapi.js

@ -35,6 +35,7 @@ export const ApiTable = {
postProjectBind: 'project/bind',//绑定安心云、项目管理项目 postProjectBind: 'project/bind',//绑定安心云、项目管理项目
getProjectAppList: 'project/app_list',//获取应用列表 getProjectAppList: 'project/app_list',//获取应用列表
deleteProjectBind: 'project/bind/{bindId}',//删除安心云、项目管理项目绑定关系 deleteProjectBind: 'project/bind/{bindId}',//删除安心云、项目管理项目绑定关系
getStructureStation: "structure/station",//获取对应结构物和重点测点
//项目分组 //项目分组
projectGroup: 'project/group', projectGroup: 'project/group',

9
web/config.js

@ -27,6 +27,7 @@ args.option('pomsEs', 'es监控 web');
args.option('pomsNotebook', 'notebook web'); args.option('pomsNotebook', 'notebook web');
args.option('dcWeb', '报表中心web'); args.option('dcWeb', '报表中心web');
args.option('networkWeb', '运维组网web'); args.option('networkWeb', '运维组网web');
args.option('traitLabel', '映射关系里重点测点监控特征标签');
//硬件升级 //硬件升级
args.option('crawapi', '硬件升级') 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 DC_WEB = process.env.DC_WEB || flags.dcWeb;
const NETWORK_WEB = process.env.NETWORK_WEB || flags.networkWeb; const NETWORK_WEB = process.env.NETWORK_WEB || flags.networkWeb;
const CRAW_API = process.env.CRAW_API || flags.crawapi; 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_AK = process.env.ANXINCLOUD_QINIU_ACCESSKEY || flags.qnak;
const ANXINCLOUD_QINIU_SK = process.env.ANXINCLOUD_QINIU_SECRETKEY || flags.qnsk; 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; const ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE = process.env.ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE || flags.qndmn;
if ( if (
!API_URL || !CRAW_API !API_URL || !CRAW_API
|| !API_EMIS_URL || !WEB_EMIS_URL || !WEB_OA_URL || !API_EMIS_URL || !WEB_EMIS_URL || !WEB_OA_URL
@ -125,7 +132,7 @@ const product = {
networkWeb:NETWORK_WEB, networkWeb:NETWORK_WEB,
staticRoot: './client', staticRoot: './client',
crawapi: CRAW_API, crawapi: CRAW_API,
traitLabel:TRAIT_LABEL,
qiniu: { qiniu: {
fetchUrl: '/_file-server', fetchUrl: '/_file-server',
domain: ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE domain: ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURCE

2
web/package.json

@ -7,7 +7,7 @@
"test": "mocha", "test": "mocha",
"start-vite": "cross-env NODE_ENV=developmentVite npm run start-params", "start-vite": "cross-env NODE_ENV=developmentVite npm run start-params",
"start": "cross-env NODE_ENV=development 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", "deploy": "export NODE_ENV=production&& npm run build && node server",
"build-dev": "cross-env NODE_ENV=development&&webpack --config webpack.config.js", "build-dev": "cross-env NODE_ENV=development&&webpack --config webpack.config.js",
"build": "cross-env NODE_ENV=production&&webpack --config webpack.config.prod.js" "build": "cross-env NODE_ENV=production&&webpack --config webpack.config.prod.js"

5
web/routes/attachment/index.js

@ -20,7 +20,7 @@ module.exports = {
const getApiRoot = async function (ctx) { const getApiRoot = async function (ctx) {
const { apiUrl, iotVcmpWeb, pomsMonitor, pomsKubesphere, pomsAmbari, pomsKowl, 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; } = opts;
ctx.status = 200; ctx.status = 200;
@ -39,7 +39,8 @@ module.exports = {
qiniu: qiniu, qiniu: qiniu,
webEmis, webEmis,
webOa, webOa,
crawapi crawapi,
traitLabel
}; };
}; };

Loading…
Cancel
Save