|
|
@ -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) { |
|
|
|