Browse Source

启用状态的修改

dev
wenlele 2 years ago
parent
commit
92a0b27d07
  1. 4
      script/0.11/schema/1.alter_alarm_push_config.sql
  2. 37
      web/client/src/sections/service/components/pushModal.jsx
  3. 21
      web/client/src/sections/service/containers/emPush.jsx

4
script/0.11/schema/1.alter_alarm_push_config.sql

@ -0,0 +1,4 @@
alter table alarm_push_config
add poms_struc_factor_id jsonb;
comment on column alarm_push_config.poms_project_factor_id is '结构物对应监测项 id';

37
web/client/src/sections/service/components/pushModal.jsx

@ -34,6 +34,7 @@ function pushModal (props) {
const [interval3, setInterval3] = useState(undefined); //
const [deviceProportion, setDeviceProportion] = useState(undefined); //
const [subType, setSubType] = useState([]); //
const [factor, setFactor] = useState([]); //
//
@ -43,11 +44,12 @@ function pushModal (props) {
getProjectPomsList()//
if (editObj.id) {
getProjectStructureList(editObj.pomsProjectId)
if (editObj.pomsProject?.pepProjectId) {
getProjectStatusList()//
} else {
let division = editObj?.pomsProject?.map(v => (v.pepProject?.id || 'POMS'))
if (division.length == 1 && division?.includes('POMS')) {
setProjectStatus([{ construction_status: 'POMS', id: 'POMS' }])
timeTypePOMS.current = ['POMS']
} else {
getProjectStatusList()//
}
if (editObj.tactics == 'immediately') {
setInterval1(editObj.tacticsParams?.interval)
@ -74,13 +76,24 @@ function pushModal (props) {
})
}
function getProjectStructureList (value) {//
dispatch(service.getProjectStructure({ pomsProjectId:value.join(',') })).then((res) => {
dispatch(service.getProjectStructure({ pomsProjectId: value.join(',') })).then((res) => {
if (res.success) {
let data = []
let ProjectId = []
res.payload?.data.map(v => {
if (ProjectId.includes(v.id)) {
} else {
ProjectId.push(v.id)
data.push(v)
}
})
let mylist = []
for (let i = 0; i < res.payload?.data.length; i++) {
mylist.push(res.payload?.data[i].id)
for (let i = 0; i < data.length; i++) {
mylist.push(data[i].id)
}
setProjectStructure(res.payload?.data)
setProjectStructure(data)
// setFactor()
form.current.setValue('strucId', mylist)
form.current.validate(['strucId', 'timeType'])
setStructure(false)
@ -93,8 +106,12 @@ function pushModal (props) {
if (res.success) {
setProjectStatus(res.payload?.data)
let mylist = []
for (let i = 0; i < res.payload?.data.length; i++) {
mylist.push(res.payload?.data[i].id)
if (editObj?.id) {
mylist = editObj?.timeType.map(Number) || []
} else {
for (let i = 0; i < res.payload?.data.length; i++) {
mylist.push(res.payload?.data[i].id)
}
}
form.current.setValue('timeType', mylist)
form.current.validate(['strucId', 'timeType'])
@ -188,7 +205,7 @@ function pushModal (props) {
}
}
if (key == 'pomsProjectId') {
getProjectStructureList(values.pomsProjectId)//
for (let i = 0; i < projectPoms.length; i++) {
if (values.pomsProjectId == projectPoms[i].id) {

21
web/client/src/sections/service/containers/emPush.jsx

@ -262,7 +262,7 @@ const EmPush = (props) => {
}
return (
projectData.map((u, index) => <div style={{ display: 'flex', alignItems: 'center' }}>
projectData.map((u, index) => <div key={'projecname' + index} style={{ display: 'flex', alignItems: 'center' }}>
{
u.anxinerror ? (
<Tooltip content={(u.projectName || u.name) + ',项目已在【项企PEP】或【映射关系】中被删除,请重选项目!'}>
@ -522,21 +522,22 @@ const EmPush = (props) => {
let enableType = ''
if (row.disable) {
enableType = '禁用'
}
else {
if (row.timeType.length > 0) {
for (let i = 0; i < row.timeType.length; i++) {
if (row.timeType[i] == row.pomsProject?.pepProject?.constructionStatusId) {
} else {
let construcId = row.pomsProject?.map(v => (v.pepProject?.constructionStatusId || 'POMS')) || []
if (construcId?.includes('POMS')) {
enableType = '已生效'
} else {
let timeType = row.timeType?.map(Number) || []
for (let i = 0; i < timeType.length; i++) {
if (construcId?.includes(timeType[i])) {
enableType = '已生效'
break;
break
} else {
enableType = '未生效'
}
}
}
else {
enableType = '已生效'
}
}
return (
<div style={{ textAlign: 'center', padding: '1px 17px', color: enableType == '禁用' ? '#FB0F0F' : enableType == '已生效' ? '#0F7EFB' : '#646566', background: enableType == '禁用' ? 'rgba(255,221,221,0.38)' : enableType == '已生效' ? 'rgba(221,237,255,0.38)' : 'rgba(192,192,192,0.38)', }}>

Loading…
Cancel
Save