Commit fe1a648d authored by zhengjiangtao's avatar zhengjiangtao

修复风险点详情失效和管控状态变化

parent 876c7aea
...@@ -3,31 +3,31 @@ import PropTypes from 'prop-types'; ...@@ -3,31 +3,31 @@ import PropTypes from 'prop-types';
import { CONSTS } from 'CONSTS/storageConsts'; import { CONSTS } from 'CONSTS/storageConsts';
import AmosGridTable from '../../../../bizview/common/tableComponent/table/AmosGridTable'; import AmosGridTable from '../../../../bizview/common/tableComponent/table/AmosGridTable';
import { riskSoureDetail3dAction } from 'SERVICES/bizService'; import { riskSoureDetail3dAction } from 'SERVICES/bizService';
import {queryPointItemAllDatas } from '../../../../../services/3dService'; import { queryPointItemAllDatas } from '../../../../../services/3dService';
const checkListColumns = self => {
const checkListColumns = (self) => {
return [ return [
{ {
title: '危险因素名称', title: '危险因素名称',
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
width: '40%' width: '40%'
}, { },
{
title: '责任人', title: '责任人',
dataIndex: 'type', dataIndex: 'type',
key: 'type', key: 'type',
width: '20%', width: '20%',
render: (text, record) => { render: (text, record) => {
//根据换行符分隔 //根据换行符分隔
let arr = text.split(","); let arr = text.split(',');
let p = document.createElement('span'); let p = document.createElement('span');
if (arr && arr !== null) { if (arr && arr !== null) {
arr.map((e, index) => { arr.map((e, index) => {
if (0 == index) { if (0 == index) {
let grandChildItem = document.createElement('p'); let grandChildItem = document.createElement('p');
grandChildItem.innerText = "公司:"; grandChildItem.innerText = '公司:';
let font = document.createElement('font'); let font = document.createElement('font');
font.innerText = e; font.innerText = e;
grandChildItem.append(font); grandChildItem.append(font);
...@@ -36,7 +36,7 @@ const checkListColumns = (self) => { ...@@ -36,7 +36,7 @@ const checkListColumns = (self) => {
if (1 == index) { if (1 == index) {
let grandChildItem = document.createElement('p'); let grandChildItem = document.createElement('p');
grandChildItem.innerText = "部门:"; grandChildItem.innerText = '部门:';
let font = document.createElement('font'); let font = document.createElement('font');
font.innerText = e; font.innerText = e;
grandChildItem.append(font); grandChildItem.append(font);
...@@ -45,7 +45,7 @@ const checkListColumns = (self) => { ...@@ -45,7 +45,7 @@ const checkListColumns = (self) => {
if (2 == index) { if (2 == index) {
let grandChildItem = document.createElement('p'); let grandChildItem = document.createElement('p');
grandChildItem.innerText = "班组:"; grandChildItem.innerText = '班组:';
let font = document.createElement('font'); let font = document.createElement('font');
font.innerText = e; font.innerText = e;
grandChildItem.append(font); grandChildItem.append(font);
...@@ -54,27 +54,24 @@ const checkListColumns = (self) => { ...@@ -54,27 +54,24 @@ const checkListColumns = (self) => {
if (3 == index) { if (3 == index) {
let grandChildItem = document.createElement('p'); let grandChildItem = document.createElement('p');
grandChildItem.innerText = "岗位:"; grandChildItem.innerText = '岗位:';
let font = document.createElement('font'); let font = document.createElement('font');
font.innerText = e; font.innerText = e;
grandChildItem.append(font); grandChildItem.append(font);
p.append(grandChildItem); p.append(grandChildItem);
} }
}); });
return <div dangerouslySetInnerHTML={{ __html: p.outerHTML }} ></div> return <div dangerouslySetInnerHTML={{ __html: p.outerHTML }}></div>;
} }
} }
},
{
}, {
title: '风险等级', title: '风险等级',
dataIndex: 'level', dataIndex: 'level',
key: 'level', key: 'level',
width: '20%' width: '20%'
}, { },
{
title: '安全管控状态', title: '安全管控状态',
dataIndex: 'controlStatus', dataIndex: 'controlStatus',
key: 'controlStatus', key: 'controlStatus',
...@@ -83,84 +80,76 @@ const checkListColumns = (self) => { ...@@ -83,84 +80,76 @@ const checkListColumns = (self) => {
]; ];
}; };
export const datamoni = { export const datamoni = {
id: 349,
name: 'XAP-P-EXD-SW01',
"id": 349, code: '0010020003',
"name": "XAP-P-EXD-SW01", user: null,
"code": "0010020003", identificationMethod: null,
"user": null, riskLevel: '3级',
"identificationMethod": null, riskType: null,
"riskLevel": "3级", riskFactors: [
"riskType": null,
"riskFactors": [
{ {
"id": 57, id: 57,
"name": "噪音", name: '噪音',
"type": " , , , ", type: ' , , , ',
"level": "3级", level: '3级',
"controlStatus": "" controlStatus: ''
}, },
{ {
"id": 58, id: 58,
"name": "设备故障", name: '设备故障',
"type": " , , , ", type: ' , , , ',
"level": "4级", level: '4级',
"controlStatus": null controlStatus: null
} }
], ],
"riskFactorsControlMeasures": [ riskFactorsControlMeasures: [
{ {
id: 22,
"id": 22, label: '测试',
"label": "测试", content: '正文'
"content": "正文"
}, },
{ {
id: 23,
"id": 23, label: '测试',
"label": "测试", content: '正文'
"content": "正文"
}, },
{ {
id: 24,
"id": 24, label: '测试',
"label": "测试", content: '正文'
"content": "正文"
} }
], ],
"dangerDetails":null dangerDetails: null
} };
const deviceData = [ const deviceData = [
{ {
"type": "device", type: 'device',
"name": "中心机房新风机", name: '中心机房新风机',
"value": "高湿报警", value: '高湿报警',
"identification": "qualified", identification: 'qualified',
"factorId": 26 factorId: 26
} }
] ];
const patrolData = [ const patrolData = [
{ {
type: 'patrol',
"type": "patrol", name: 'A02机柜',
"name": "A02机柜", value: '【(2U-14U)750服务器01】工作指示灯',
"value": "【(2U-14U)750服务器01】工作指示灯", identification: 'qualified',
"identification": "qualified", factorId: 31
"factorId": 31
}, },
{ {
type: 'patrol',
"type": "patrol", name: 'A02机柜',
"name": "A02机柜", value: '【(2U-14U)750服务器01】噪声',
"value": "【(2U-14U)750服务器01】噪声", identification: 'qualified',
"identification": "qualified", factorId: 31
"factorId": 31
} }
] ];
/** /**
* 风险详情 * 风险详情
...@@ -176,7 +165,7 @@ class RiskSourceDetailModal extends Component { ...@@ -176,7 +165,7 @@ class RiskSourceDetailModal extends Component {
selectedRowKeys: [], selectedRowKeys: [],
data: {}, data: {},
patroList: [], patroList: [],
deviceList:[] deviceList: []
}; };
} }
...@@ -190,34 +179,29 @@ class RiskSourceDetailModal extends Component { ...@@ -190,34 +179,29 @@ class RiskSourceDetailModal extends Component {
const { tirggerTransTopic } = this.props; const { tirggerTransTopic } = this.props;
const detailParams = { type: 'risk', detailForw: 'record', dialogId: pointId }; const detailParams = { type: 'risk', detailForw: 'record', dialogId: pointId };
pointId && tirggerTransTopic && tirggerTransTopic(CONSTS.forward, { details: detailParams, dateTime: Date.now() }); pointId && tirggerTransTopic && tirggerTransTopic(CONSTS.forward, { details: detailParams, dateTime: Date.now() });
} };
queryRiskSoureDetail = (riskSourceId) => {
queryRiskSoureDetail = riskSourceId => {
riskSoureDetail3dAction(riskSourceId).then(data => { riskSoureDetail3dAction(riskSourceId).then(data => {
this.setState({ data }); this.setState({ data });
data.riskFactors.map(e =>{ data.riskFactors.map(e => {
let {patroList,deviceList} =this.state; let { patroList, deviceList } = this.state;
queryPointItemAllDatas(e.id).then(datas =>{ queryPointItemAllDatas(e.id).then(datas => {
datas.patrol&& datas.patrol.map(item =>{ datas.patrol &&
patroList.push(item) datas.patrol.map(item => {
}) patroList.push(item);
});
datas.device && datas.device.map(item =>{
deviceList.push(item)
})
this.setState({ patroList:patroList, deviceList:deviceList});
})
})
datas.device &&
datas.device.map(item => {
deviceList.push(item);
}); });
} this.setState({ patroList: patroList, deviceList: deviceList });
});
});
});
};
/** /**
* 获取表格刷新方法 * 获取表格刷新方法
*/ */
...@@ -243,83 +227,90 @@ class RiskSourceDetailModal extends Component { ...@@ -243,83 +227,90 @@ class RiskSourceDetailModal extends Component {
// }); // });
// } // }
renderDangersPatrol = (danger) => { renderDangersPatrol = danger => {
return (danger || []).map(item =>{ return (danger || []).map(item => {
if(item && item.identification==="unqualified"){ if (item && item.identification === 'unqualified') {
return (<p > <font style={{ color: '#FF0000' }}>巡检不合格:</font> return (
<p>
{' '}
<font style={{ color: '#FF0000' }}>巡检不合格:</font>
<span>{item.name} &nbsp;</span> <span>{item.name} &nbsp;</span>
<span>{item.value} &nbsp;</span> <span>{item.value} &nbsp;</span>
</p>); </p>
);
} }
}) });
// return (danger || []).map(item => { // return (danger || []).map(item => {
// return (<p > <font style={{ color: '#FF0000' }}>巡检不合格:</font> // return (<p > <font style={{ color: '#FF0000' }}>巡检不合格:</font>
// <span>{item.name} &nbsp;</span> // <span>{item.name} &nbsp;</span>
// <span>{item.value} &nbsp;</span> // <span>{item.value} &nbsp;</span>
// </p>); // </p>);
// }); // });
} };
renderDangersDevice= (danger) => { renderDangersDevice = danger => {
// return (danger || []).map(item => { // return (danger || []).map(item => {
// return (<p > <font style={{ color: '#FF0000' }}>设备告警:</font> // return (<p > <font style={{ color: '#FF0000' }}>设备告警:</font>
// <span>{item.name} &nbsp;</span> // <span>{item.name} &nbsp;</span>
// <span>{item.value} &nbsp;</span> // <span>{item.value} &nbsp;</span>
// </p>); // </p>);
// }); // });
return (danger || []).map(item =>{ return (danger || []).map(item => {
if(item && item.identification==="unqualified"){ if (item && item.identification === 'unqualified') {
return (<p > <font style={{ color: '#FF0000' }}>设备告警:</font> return (
<p>
{' '}
<font style={{ color: '#FF0000' }}>设备告警:</font>
<span>{item.name} &nbsp;</span> <span>{item.name} &nbsp;</span>
<span>{item.value} &nbsp;</span> <span>{item.value} &nbsp;</span>
</p>); </p>
} );
})
} }
});
};
handledata = (data, patroList, deviceList) => {
if (data.riskFactors) {
data.riskFactors.map(e => {
e.controlStatus = '受控';
});
handledata =(data,patroList,deviceList)=>{ data.riskFactors.map(item => {
patroList.map(p => {
if(data.riskFactors){ if ((item.id === p.factorId && p.identification === 'unqualified')) {
data.riskFactors.map(e =>{ item.controlStatus = '失效';
e.controlStatus = "受控";
})
data.riskFactors.map(item =>{
patroList.map(p =>{
if(item.id = p.factorId && p.identification==="unqualified"){
item.controlStatus = "失效";
} }
}) });
deviceList.map(p =>{ deviceList.map(p => {
if(item.id = p.factorId && p.identification==="unqualified"){ if ((item.id === p.factorId && p.identification === 'unqualified')) {
item.controlStatus = "失效"; item.controlStatus = '失效';
} }
}) });
}) });
} }
return data; return data;
} };
render() { render() {
let { data = {} } = this.state; let { data = {} } = this.state;
let {patroList,deviceList} = this.state; let { patroList, deviceList } = this.state;
let newData = this.handledata(data,patroList,deviceList); let newData = this.handledata(data, patroList, deviceList);
return ( return (
<div className="risk-warn"> <div className="risk-warn">
<div className="risk-source-header"> <div className="risk-source-header">
<span className="colName">风险编号:</span><span className="colValue">{data.code || ''}</span> <span className="colName">风险编号:</span>
<span className="colName">风险名称:</span><span className="colValue">{data.name || ''}</span> <span className="colValue">{data.code || ''}</span>
<span className="colName">级别:</span><span className="colValue">{data.riskLevel || ''}</span> <span className="colName">风险名称:</span>
<span className="colValue">{data.name || ''}</span>
<span className="colName">级别:</span>
<span className="colValue">{data.riskLevel || ''}</span>
</div> </div>
<div className="risk-warn-table"> <div className="risk-warn-table">
<AmosGridTable <AmosGridTable
columns={checkListColumns(this)} columns={checkListColumns(this)}
getTableDataAction={() => { }} getTableDataAction={() => {}}
callBack={this.reload} callBack={this.reload}
isPageable={false} isPageable={false}
isChecked={false} isChecked={false}
...@@ -328,8 +319,8 @@ class RiskSourceDetailModal extends Component { ...@@ -328,8 +319,8 @@ class RiskSourceDetailModal extends Component {
</div> </div>
<div className="risk-warn-content"> <div className="risk-warn-content">
<div className="risk-warn-content-header">风险触发原因:巡检不合格/设备告警</div> <div className="risk-warn-content-header">风险触发原因:巡检不合格/设备告警</div>
{patroList &&this.renderDangersPatrol(patroList)} {patroList && this.renderDangersPatrol(patroList)}
{deviceList &&this.renderDangersDevice(deviceList)} {deviceList && this.renderDangersDevice(deviceList)}
</div> </div>
</div> </div>
); );
...@@ -341,5 +332,4 @@ RiskSourceDetailModal.propTypes = { ...@@ -341,5 +332,4 @@ RiskSourceDetailModal.propTypes = {
tirggerTransTopic: PropTypes.func tirggerTransTopic: PropTypes.func
}; };
export default RiskSourceDetailModal; export default RiskSourceDetailModal;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment