Commit b597e794 authored by taabe's avatar taabe

需求变更:

1、增加危险因素评价页面 2、危险因素绑定设备改为设备指标指标
parent 344a4291
......@@ -103,6 +103,7 @@ export const FasSerUrl = {
// 换流站视图
//*******************************************************************************
riskLevelListUrl: completePrefix(baseURI, 'api/riskLevel/pagelist?pageNumber={page}&pageSize={size}'),
getAllRiskLevelUrl: completePrefix(baseURI, 'api/riskLevel/all-list'),
accidentTypeListUrl: completePrefix(baseURI, 'api/accidentType/pagelist?pageNumber={page}&pageSize={size}'),
riskFactorListUrl: completePrefix(baseURI, 'api/riskFactor/pagelist?pageNumber={page}&pageSize={size}'),
evaModelListUrl: completePrefix(baseURI, 'api/fmeaEvaluate/list?type={type}'),
......@@ -138,16 +139,17 @@ export const FasSerUrl = {
femaEditUrl: completePrefix(baseURI, 'api/riskModel/fmea/editFmea'), //fmea编辑
fmeaDeleteUrl: completePrefix(baseURI, 'api/riskModel/fmea/deleteFmea'), //fmea删除
fmeaPageListUrl: completePrefix(baseURI, 'api/riskModel/fmea/list?pageNumber={page}&pageSize={size}'), //fmea分页查询
assoPointListUrl: completePrefix(baseURI, 'api/risksource/getBindPoints?riskSourceId={riskSourceId}&pageNumber={page}&pageSize={size}'),
assoEquipListUrl: completePrefix(baseURI, 'api/risksource/{riskSourceId}/fireequiment/relations?pageNumber={page}&pageSize={size}'),
assoPointListUrl: completePrefix(baseURI, 'api/risksource/getBindPoints?fmeaId={fmeaId}&pageNumber={page}&pageSize={size}'),
assoEquipListUrl: completePrefix(baseURI, 'api/risksource/{fmeaId}/fireequiment/relations?pageNumber={page}&pageSize={size}'),
riskFactorNoPageUrl: completePrefix(baseURI, 'api/riskFactor/all-list'),
deptByOrgCodeUrl: completePrefix(baseURI, 'api/common/deptment/list'),//部门查询,
pointListUrl: completePrefix(baseURI, 'api/common/pointList?pageNumber={page}&pageSize={size}'),//巡检点查询
pointInputListUrl: completePrefix(baseURI, 'api/common/pointInputlist?pageNumber={page}&pageSize={size}'),//巡检点项查询
bindPointUrl: completePrefix(baseURI, 'api/risksource/bindPoints/{riskSourceId}'),//巡检点关联
bindPointUrl: completePrefix(baseURI, 'api/risksource/bindFmea/pointInputitem'),//巡检点关联
riskSourceRpnCountUrl: completePrefix(baseURI,'api/risksource/rpn/list'), // 查询风险点RPN统计
bindEquipListUrl: completePrefix(baseURI, 'api/risksource/{riskSourceId}/fireequiment/relation/all?equimentId={equimentId}&fname={fname}&pageNumber={page}&pageSize={size}'),//配套设施查询(已绑定及未绑定)
bindEquipUrl: completePrefix(baseURI, 'api/risksource/{riskSourceId}/fireequiment/relation'),
bindEquipListUrl: completePrefix(baseURI, 'api/risksource/fireequiment/relation/all?equimentId={equimentId}&fname={fname}&pageNumber={page}&pageSize={size}'),//配套设施查询(已绑定及未绑定)
getBindEquipIndexUrl: completePrefix(baseURI, 'api/risksource/listEquipmentPointById?fmeaId={fmeaId}&equimentId={equimentId}&fname={fname}&pageNumber={page}&pageSize={size}'),//获取配套设备指标项
bindEquipIndexUrl: completePrefix(baseURI, 'api/risksource/bingFmea/equimentPoint'),
deleteBindEquipUrl: completePrefix(baseURI, 'api/risksource/fireequiment/relation/{ids}'),
removeByRSIdAndPIdUrl: completePrefix(baseURI, 'api/risksource/removeByRSIdAndPId'),//删除绑定的设备
riskSourceMatrixUrl: completePrefix(baseURI,'api/risksource/matrix'), // 查询风险点发生率/严重度矩阵
......@@ -211,7 +213,8 @@ export const FasSerUrl = {
fileDownloadDocs: completePrefix(baseURI, 'file/download'),//查看文档
lookHtmlTextNavData: completePrefix(baseURI, 'file/lookHtmlTextNav'), //文档转换为html,带导航
getTextPlanUrl: completePrefix(baseURI, 'api/visual/plan/text/{id}'),//获取文字预案信息
uploadTextPlan: completePrefix(baseURI, 'file/plan/{appId}/texts')
uploadTextPlan: completePrefix(baseURI, 'file/plan/{appId}/texts'),
getTreeNodeTypeUrl: completePrefix(baseURI, 'api/riskModel/riskSource/getChildTypeByPid?riskSourceId={riskSourceId}')// 根据节点ID获取子节点可能的类型
};
......
......@@ -6,6 +6,10 @@ export const queryRiskLevelAction = (filter, page, size) => {
return commonPost(formatUrl(FasSerUrl.riskLevelListUrl, { page, size }), filter);
};
export const queryAllRiskLevelAction = () => {
return commonGet(FasSerUrl.getAllRiskLevelUrl );
};
export const queryAccidentTypelAction = (filter, page, size) => {
return commonPost(formatUrl(FasSerUrl.accidentTypeListUrl, { page, size }), filter);
};
......@@ -75,16 +79,16 @@ export const fmeaPageListAction = (filter, page, size) => {
};
export const queryAssoPointListAction = (riskSourceId, page, size) => {
return commonGet(formatUrl(FasSerUrl.assoPointListUrl, { riskSourceId, page, size }));
export const queryAssoPointListAction = (fmeaId, page, size) => {
return commonGet(formatUrl(FasSerUrl.assoPointListUrl, { fmeaId, page, size }));
};
export const queryRiskFactorNoPageAction = () => {
return commonGet(formatUrl(FasSerUrl.riskFactorNoPageUrl, {}));
};
export const queryAssoEquipListAction = (riskSourceId, page, size) => {
return commonGet(formatUrl(FasSerUrl.assoEquipListUrl, {riskSourceId, page, size}));
export const queryAssoEquipListAction = (fmeaId, page, size) => {
return commonGet(formatUrl(FasSerUrl.assoEquipListUrl, { fmeaId, page, size }));
};
export const queryDeptByOrgCodeAction = () => {
......@@ -99,20 +103,25 @@ export const queryPointInputPageListAction = (filter, page, size) => {
return commonPost(formatUrl(FasSerUrl.pointInputListUrl, { page, size }), filter);
};
export const bindPointsAction = (riskSourceId, body) => {
return commonPost(formatUrl(FasSerUrl.bindPointUrl, { riskSourceId }), body);
export const bindPointsAction = (param) => {
return commonPost(FasSerUrl.bindPointUrl, param);
};
export const bindEquipListAction = (riskSourceId , equimentId, page, size,fname) => {
return commonGet(formatUrl(FasSerUrl.bindEquipListUrl, {riskSourceId,equimentId,fname,page,size}));
return commonGet(formatUrl(FasSerUrl.bindEquipListUrl, { riskSourceId,equimentId,fname,page,size }));
};
export const getBindEquipIndexAction = (fmeaId, equimentId, page, size, fname) => {
let url = formatUrl(FasSerUrl.getBindEquipIndexUrl, { fmeaId, equimentId, fname, page, size });
return commonGet(url);
};
export const bindEquipAction = (riskSourceId, body) => {
return commonPost(formatUrl(FasSerUrl.bindEquipUrl, { riskSourceId }), body);
export const bindEquipIndexAction = (body) => {
return commonPost(FasSerUrl.bindEquipIndexUrl, body);
};
export const deleteBindEquipAction = (ids) => {
return commonDelete(formatUrl(FasSerUrl.deleteBindEquipUrl, {ids}));
return commonDelete(formatUrl(FasSerUrl.deleteBindEquipUrl, { ids }));
};
export const deleteAssoPointAction = (body) => {
......@@ -141,6 +150,11 @@ export const getRiskSourceSecondLevelAction = () => {
return commonGet(formatUrl(FasSerUrl.riskSourceSecondLevelUrl,{}));
};
export const getTreeNodeTypeAction = (riskSourceId) => {
let url = formatUrl(FasSerUrl.getTreeNodeTypeUrl, { riskSourceId });
return commonGet(url);
};
/**
* 获取预案树
*/
......
......@@ -148,6 +148,13 @@
}
.risk-model-table {
width: 100%;
overflow-x: scroll;
.grid-content {
width: 1500px;
}
.ant-table-title {
display: none;
}
......@@ -165,7 +172,7 @@
.equip-model {
.equip-model-equip {
width: 40%;
width: 33%;
display: inline-block;
height: 32rem;
border: 1px solid $biz-border-color;
......@@ -196,7 +203,7 @@
}
}
.equip-model-fire {
width: calc(60% - 1rem);
width: 32%;
display: inline-block;
vertical-align: top;
margin-left: 1rem;
......@@ -312,7 +319,7 @@
background: $biz-title-color;
}
.amos-modal-container {
width: 50% !important;
// width: 50% !important;
}
.amos-form-item {
margin-bottom: 1.5rem;
......
import React, { Component } from 'react';
import { DatePicker } from 'amos-antd';
import moment from 'moment';
import { Form, AmosAlert, Input, Select } from 'amos-framework';
import { Form, AmosAlert, Input, Select, InputNumber } from 'amos-framework';
import { riskLevelEditAction } from '../../../../../services/preControlService';
const FormItem = Form.Item;
......@@ -21,35 +19,44 @@ class RiskLevelModel extends Component {
searchParam: [],
form: {
level: '',
severity: ''
severity: '',
topLimit: 1,
downLimit: 1
},
rules: {
level: [{ required: true, message: '风险级等级不能为空' }],
severity: [{ required: true, message: '严重程度影响描述不能为空' }]
severity: [{ required: true, message: '严重程度影响描述不能为空' }],
topLimit: [{ required: true, message: '等级上限不能为空' }],
downLimit: [{ required: true, message: '等级下限不能为空' }]
}
};
}
componentWillMount = () => {
const { selectRowData } = this.props || {};
if(selectRowData){
let form ={};
if (selectRowData) {
let form = {};
Object.assign(form, selectRowData);
this.setState({ form });
}
};
onSelectChange = (key, value) => {
const { form } = this.state;
form[key] = value;
if(key === 'level'){
form['name'] = value+'级';
if (key === 'level'){
form['name'] = value + '级';
form['color'] = colorEum[value] ;
}
this.setState({ form });
};
onChange = (value, type) => {
let { form } = this.state;
form[type] = value;
this.setState({ form });
}
handleSubmit = e => {
this.form.validate((valid, dataValues) => {
if (valid) {
......@@ -100,6 +107,12 @@ class RiskLevelModel extends Component {
onChange={(value)=> this.onSelectChange('level', value)}
/>
</FormItem>
<FormItem label={<span>上限</span>} field="topLimit" {...formItemLayout}>
<InputNumber defaultValue={1} max={1000} min={1} value={form.topLimit} onChange={value => this.onChange(value, 'topLimit')} />
</FormItem>
<FormItem label={<span>下限</span>} field="downLimit" {...formItemLayout}>
<InputNumber defaultValue={1} max={1000} min={1} value={form.downLimit} onChange={value => this.onChange(value, 'downLimit')} />
</FormItem>
<FormItem label={<span>严重程度影响描述</span>} field="severity" {...formItemLayout}>
<TextArea className="risk_lever_input" value={form.severity} onChange={e => this.onSelectChange('severity', e.target.value)} />
</FormItem>
......
......@@ -4,11 +4,9 @@ import moment from 'moment';
import AmosGridTable from './../../../common/tableComponent/table/AmosGridTable';
import { Modal, AmosAlert } from 'amos-framework';
import {
riskLevelDeleteAction,
riskLevelDeleteAction
} from '../../../../../services/preControlService';
import RiskLevelModel from './RiskLevelModel';
import { browserHistory } from 'amos-react-router';
const getColumns = () => {
return [
......@@ -34,7 +32,21 @@ const getColumns = () => {
title: '图标颜色',
dataIndex: 'color',
key: 'color',
width: '15%',
width: '10%',
className: 'uant-table-thead'
},
{
title: '上限',
dataIndex: 'topLimit',
key: 'topLimit',
width: '5%',
className: 'uant-table-thead'
},
{
title: '下限',
dataIndex: 'downLimit',
key: 'downLimit',
width: '5%',
className: 'uant-table-thead'
},
{
......@@ -48,14 +60,13 @@ const getColumns = () => {
title: '维护日期',
dataIndex: 'createDate',
key: 'createDate',
width: '20%',
width: '15%',
render: text =>moment(text).format('YYYY-MM-DD HH:mm:ss'),
className: 'uant-table-thead'
}
];
};
/**
* 风险等级
*/
......
......@@ -7,15 +7,15 @@ const getColumns = () => {
return [
{
title: '设备编号',
dataIndex: 'fCode',
key: 'fCode',
dataIndex: 'equipmentCode',
key: 'equipmentCode',
width: '10%',
className: 'uant-table-thead'
},
{
title: '设备名称',
dataIndex: 'fName',
key: 'fName',
dataIndex: 'equipmentName',
key: 'equipmentName',
width: '30%',
className: 'uant-table-thead'
},
......@@ -28,8 +28,8 @@ const getColumns = () => {
},
{
title: '监测对象',
dataIndex: 'eName',
key: 'eName',
dataIndex: 'equipmentPointNames',
key: 'equipmentPointNames',
width: '30%',
className: 'uant-table-thead'
}
......@@ -142,7 +142,7 @@ class AssociatedEquipTable extends Component {
dataList={dataList}
totals={totalCount}
getTableDataAction={param => fetchData(param, this)}
selectedRowKeys = {selectedRowKeys}
selectedRowKeys={selectedRowKeys}
getSelectedRows={this.getSelectedRows}
rowClassName={this.getRowClassName}
setPageConfig={this.setPageConfig}
......
......@@ -4,54 +4,54 @@ import moment from 'moment';
import AmosGridTable from './../../common/tableComponent/table/AmosGridTable';
const getColumns = () => {
const getColumns = (self) => {
return [
{
title: '危险因素',
dataIndex: 'riskFactorName',
key: 'riskFactorName',
width: '10%',
width: '8%',
className: 'uant-table-thead'
},
{
title: '事故类型',
dataIndex: 'accidentTypeName',
key: 'accidentTypeName',
width: '6%',
width: '5%',
className: 'uant-table-thead'
},
{
title: '失效影响/事故',
dataIndex: 'influence',
key: 'influence',
width: '11%',
width: '10%',
className: 'uant-table-thead'
},
{
title: '严重度Si',
dataIndex: 'evaluationS',
key: 'evaluationS',
width: '6%',
width: '5%',
className: 'uant-table-thead'
},
{
title: '故障频数Oi',
dataIndex: 'evaluationO',
key: 'evaluationO',
width: '6%',
width: '5%',
className: 'uant-table-thead'
},
{
title: '探测度Di',
dataIndex: 'evaluationD',
key: 'evaluationD',
width: '6%',
width: '5%',
className: 'uant-table-thead'
},{
title: 'RPNi',
dataIndex: 'rpni',
key: 'rpni',
width: '5%',
width: '4%',
className: 'uant-table-thead'
},{
title: '管控措施',
......@@ -59,33 +59,52 @@ const getColumns = () => {
title: '工程措施',
dataIndex: 'engineering',
key: 'engineering',
width: '10%',
width: '9%',
className: 'uant-table-thead'
},{
title: '管理措施',
dataIndex: 'management',
key: 'management',
width: '10%',
width: '9%',
className: 'uant-table-thead'
},{
title: '培训教育',
dataIndex: 'train',
key: 'train',
width: '10%',
width: '9%',
className: 'uant-table-thead'
},{
title: '个体防护',
dataIndex: 'protection',
key: 'protection',
width: '10%',
width: '9%',
className: 'uant-table-thead'
},{
title: '应急处置',
dataIndex: 'disposal',
key: 'disposal',
width: '10%',
width: '9%',
className: 'uant-table-thead'
}]
},{
title: '责任人',
dataIndex: 'charger',
key: 'charger',
width: '5%',
className: 'uant-table-thead'
},{
title: '管控对象',
dataIndex: 'controlObj',
key: 'controlObj',
width: '5%',
render: (text, record, index) => {
return (
<span>
<a href="javascript:;" onClick={() => {self.onDetailClick(record);}}>查看</a>
</span>
);
},
className: 'uant-table-thead'
}
];
};
......@@ -115,6 +134,11 @@ class FmeaTable extends Component {
}
onDetailClick = (record) => {
console.log(record);
this.props.fmeaItemDetailCallback(record.id);
}
/**
* 分页设置参数
*/
......@@ -196,7 +220,7 @@ class FmeaTable extends Component {
return (
<div className="risk-model-table">
<AmosGridTable
columns={getColumns()}
columns={getColumns(this)}
callBack={this.reload}
isPageable={pagination}
dataList={dataList}
......@@ -216,6 +240,6 @@ class FmeaTable extends Component {
}
FmeaTable.propTypes = {
fmeaItemDetailCallback: PropTypes.func
};
export default FmeaTable;
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Button, Select } from 'amos-framework';
import { Button } from 'amos-framework';
import BizIcon from './../../../../common/icon/BizIcon';
const Option = Select.Option;
/**
* 工具栏
......@@ -19,29 +18,33 @@ class ToolBar extends Component {
componentWillMount(){
};
}
onClick =(e,value)=>{
let { onButtonClick, activeKey,parent } = this.props;
let { onButtonClick, activeKey, parent } = this.props;
onButtonClick(value,activeKey,parent);
}
render() {
const { activeKey } = this.props;
return (
<div className='risk-lever-toolbar'>
<div className ='risk-lever-button' >
<Button icon={<BizIcon icon="tianjia" />} transparent onClick = {e => this.onClick(e,'1')}></Button>
<Button icon={<BizIcon icon="xiugai" />} transparent onClick = {e => this.onClick(e,'2')}></Button>
<Button icon={<BizIcon icon="shanchu" />} transparent onClick = {e => this.onClick(e,'3')}></Button>
<div className='risk-lever-button' >
<Button title='添加' icon={<BizIcon icon="tianjia" />} transparent onClick={e => this.onClick(e,'1')} />
{ activeKey === '2' && <Button title='修改' icon={<BizIcon icon="xiugai" />} transparent onClick={e => this.onClick(e,'2')} />}
{ activeKey === '1' && <Button title='评价' icon={<BizIcon icon="buzhou-queren" />} transparent onClick={e => this.onClick(e,'4')} />}
<Button title='删除' icon={<BizIcon icon="shanchu" />} transparent onClick={e => this.onClick(e,'3')} />
</div>
</div>
);
}
}
ToolBar.propTypes = {};
ToolBar.propTypes = {
onButtonClick: PropTypes.func,
activeKey: PropTypes.any,
parent: PropTypes.any
};
export default ToolBar;
\ No newline at end of file
......@@ -11,11 +11,12 @@ import {
queryAssoPointListAction,
queryAssoEquipListAction,
bindPointsAction,
bindEquipAction ,
bindEquipIndexAction ,
deleteBindEquipAction,
deleteAssoPointAction,
queryRiskSourceDetailAction,
updateRiskSourceRpniAction
updateRiskSourceRpniAction,
getTreeNodeTypeAction
} from '../../../../services/preControlService';
import ToolBar from './common/ToolBar';
import FmeaTable from './FmeaTable';
......@@ -26,7 +27,8 @@ import FmeaModel from './model/FmeaModel';
import PointModel from './model/PointModel';
import EquipModel from './model/EquipModel';
import BizIcon from './../../../common/icon/BizIcon';
import RiskFactorModel from './model/RiskFactorModel';
import EvaluationModel from './model/EvaluationModel';
const TabPane = Tabs.TabPane;
const TreeNode = Tree.TreeNode;
......@@ -63,7 +65,8 @@ class RiskModel extends Component {
searchParam: [],
expandedKeys: [],
selectedKeys: [],
rightClickNodeTreeItem: null
rightClickNodeTreeItem: null,
treeNodeType: 3 //3:无孩子节点,2:子节点有风险节点,1:子节点有风险区域
};
}
......@@ -112,13 +115,13 @@ class RiskModel extends Component {
}
requestMethod =(activeKey) => {
let { searchParam, subActiveKey, riskSourceId } = this.state;
let { searchParam, subActiveKey, fmeaId } = this.state;
if (activeKey === '1'){
this.queryFmeaListData(searchParam, this.pageConfig.pageNumber, this.pageConfig.pageSize);
} else if (activeKey === '2' && subActiveKey === '2-1'){
this.queryAssoPointListData(riskSourceId, this.pageConfig.pageNumber, this.pageConfig.pageSize);
this.queryAssoPointListData(fmeaId, this.pageConfig.pageNumber, this.pageConfig.pageSize);
} else if (activeKey === '2' && subActiveKey === '2-2'){
this.queryAssoEquipListData(riskSourceId, this.pageConfig.pageNumber, this.pageConfig.pageSize);
this.queryAssoEquipListData(fmeaId, this.pageConfig.pageNumber, this.pageConfig.pageSize);
}
}
......@@ -129,9 +132,9 @@ class RiskModel extends Component {
} else {
if (activeKey === '1'){//设置:打开弹出框,新增或者维护标记,弹出框类型
this.fmeaRef.reloadPage();
} else if (activeKey === '2' && subActiveKey === '2-1'){
} else if (activeKey === '2' && subActiveKey === '2-1' && this.pointRef){
this.pointRef.reloadPage();
} else if (activeKey === '2' && subActiveKey === '2-2'){
} else if (activeKey === '2' && subActiveKey === '2-2' && this.equipRef){
this.equipRef.reloadPage();
}
}
......@@ -157,7 +160,7 @@ class RiskModel extends Component {
_table.state.selectedRowKeys = [];
_table.state.selectedRows = [];
}
let { riskSourceId, searchParam, activeKey, subActiveKey } = this.state;
let { riskSourceId, searchParam, activeKey, subActiveKey, fmeaId } = this.state;
if (param.current != null) {
//前端的current 即后端的pageNumber
param.pageNumber = param.current;
......@@ -166,22 +169,22 @@ class RiskModel extends Component {
if (riskSourceId){//选择树后才能切换tab查询
if (activeKey === '1'){
this.queryFmeaListData(searchParam, pageNumber, pageSize);
} else if (activeKey === '2' && subActiveKey === '2-1' ){
this.queryAssoPointListData(riskSourceId, pageNumber, pageSize);
} else if (activeKey === '2' && subActiveKey === '2-2'){
this.queryAssoEquipListData(riskSourceId, pageNumber, pageSize);
} else if (activeKey === '2' && subActiveKey === '2-1' && fmeaId ){
this.queryAssoPointListData(fmeaId, pageNumber, pageSize);
} else if (activeKey === '2' && subActiveKey === '2-2' && fmeaId){
this.queryAssoEquipListData(fmeaId, pageNumber, pageSize);
}
}
};
queryFmeaListData =(searchParam, pageNumber, pageSize)=>{
queryFmeaListData = (searchParam, pageNumber, pageSize) => {
fmeaPageListAction(searchParam, pageNumber, pageSize).then(data=>{
this.setState({ fmeaData: data.content, fmeaDataTotalNum: data.totalElements });
});
}
queryAssoPointListData = (searchParam, pageNumber, pageSize) =>{
queryAssoPointListAction(searchParam, pageNumber, pageSize).then(data =>{
queryAssoPointListData = (fmeaId, pageNumber, pageSize) =>{
queryAssoPointListAction(fmeaId, pageNumber, pageSize).then(data =>{
let pointData = [];
Object.assign(pointData, data.content);
data.content.map(item => {
......@@ -193,8 +196,8 @@ class RiskModel extends Component {
});
}
queryAssoEquipListData = (searchParam, pageNumber, pageSize) =>{
queryAssoEquipListAction(searchParam, pageNumber, pageSize).then(data =>{
queryAssoEquipListData = (fmeaId, pageNumber, pageSize) =>{
queryAssoEquipListAction(fmeaId, pageNumber, pageSize).then(data =>{
this.setState({ equipData: data.content, equipDataTotalNum: data.totalElements });
});
}
......@@ -222,14 +225,13 @@ class RiskModel extends Component {
});
}
onToolBarClick =(toolBarFlag,activeKey,parent)=>{
onToolBarClick = (toolBarFlag, activeKey, parent) => {
const { subActiveKey } = this.state;
if (toolBarFlag === '1'){//新增
if (toolBarFlag === '1') {//新增
this.setOpenModelParam(activeKey, subActiveKey, toolBarFlag);
} else if (toolBarFlag === '2'){//编辑
} else if (toolBarFlag === '2') {//编辑
let selectedRowKeys, selectedRows;
if (activeKey === '1'){//设置:打开弹出框,新增或者维护标记,弹出框类型
if (activeKey === '1') {//设置:打开弹出框,新增或者维护标记,弹出框类型
selectedRowKeys = parent.fmeaRef.state.selectedRowKeys;
selectedRows = parent.fmeaRef.state.selectedRows;
} else if (activeKey === '2' && subActiveKey === '2-1'){
......@@ -244,7 +246,7 @@ class RiskModel extends Component {
return;
}
this.setOpenModelParam(activeKey, subActiveKey, toolBarFlag);
} else if (toolBarFlag === '3'){//删除
} else if (toolBarFlag === '3') {//删除
let selectedRowKeys, selectedRows;
if (activeKey === '1'){//设置:打开弹出框,新增或者维护标记,弹出框类型
selectedRowKeys = parent.fmeaRef.state.selectedRowKeys;
......@@ -261,6 +263,18 @@ class RiskModel extends Component {
return;
}
this.deleteParamByActiveKey(selectedRowKeys, selectedRows, activeKey, subActiveKey);
} else if (toolBarFlag === '4') {//风险因素评价
let selectedRowKeys;
selectedRowKeys = parent.fmeaRef.state.selectedRowKeys;
if (selectedRowKeys === undefined || selectedRowKeys.length <= 0){
AmosAlert.warning('提示', '请先选择一个风险');
return;
}
if (selectedRowKeys.length > 1) {
AmosAlert.warning('提示', '请选择一个风险进行评价');
return;
}
this.setOpenModelParam(activeKey, subActiveKey, toolBarFlag);
}
}
......@@ -285,7 +299,7 @@ class RiskModel extends Component {
}
}
getToolBar =(activeKey, parent)=>{
getToolBar = (activeKey, parent) => {
return <ToolBar onButtonClick={this.onToolBarClick} parent={parent} activeKey={activeKey} />;
}
......@@ -293,10 +307,10 @@ class RiskModel extends Component {
this.setState({ modal: false });
};
onOk = (modelFlag) =>{
onOk = (modelFlag, toolBarFlag) =>{
const { form, selectData } = this.model.state;
const { riskSourceId } = this.state;
if (modelFlag === 'risk'){
const { riskSourceId, fmeaId } = this.state;
if (modelFlag === 'risk') {
this.model.form.validate((valid, dataValues) => {
if (valid) {
this.riskSourceEdit(form);
......@@ -305,26 +319,49 @@ class RiskModel extends Component {
return false;
}
});
} else if (modelFlag === 'fmea'){
} else if (modelFlag === 'fmea') {
if (riskSourceId) {
Object.assign(form, { 'riskSourceId': riskSourceId });
this.model.form.validate((valid, dataValues) => {
if (valid) {
form.rpni = parseInt(form.evaluationS)*parseInt(form.evaluationO)*parseInt(form.evaluationD);
this.femaEdit(form);
let fmeaObjList = [];
if (toolBarFlag === '4') {
fmeaObjList.push(form);
} else {
let ids = form.riskFactorIds;
ids.map(id => {
let fmeaObj = {};
Object.assign(fmeaObj, form);
fmeaObj.riskFactorsId = id;
fmeaObjList.push(fmeaObj);
});
}
this.femaEdit(fmeaObjList);
this.setState({ modal: false });
} else {
return false;
}
});
}
} else if (modelFlag === 'point'){
riskSourceId && this.bindPoints(riskSourceId , selectData);
this.setState({ modal: false });
} else if ( modelFlag === 'equip'){
riskSourceId && this.bindEquips(riskSourceId , selectData);
this.setState({ modal: false });
} else if (modelFlag === 'point') {
// fmeaId && this.bindPoints(fmeaId , selectData);
// this.setState({ modal: false });
} else if ( modelFlag === 'equip') {
// fmeaId && this.bindEquips(fmeaId , selectData);
// this.setState({ modal: false });
}
}
bindPointsCallback = () => {
const { fmeaId } = this.state;
const { selectData } = this.model.state;
fmeaId && this.bindPoints(fmeaId, selectData);
}
bindEquipIndexCallback = () => {
const { fmeaId } = this.state;
const { selectData } = this.model.state;
fmeaId && this.bindEquipIndexs(fmeaId , selectData);
}
riskSourceEdit = (body) =>{
......@@ -339,9 +376,16 @@ class RiskModel extends Component {
);
};
bindPoints = (riskSourceId, body) =>{
bindPointsAction(riskSourceId, body).then(
bindPoints = (fmeaId, pointInputItems) => {
let pointInputitemIds = [];
let param = {};
pointInputItems.map(item => {
pointInputitemIds.push(item.pointInputitemId);
param.pointId = item.pointId;
});
param.fmeaId = fmeaId;
param.pointInputitemIds = pointInputitemIds;
bindPointsAction(param).then(
data => {
AmosAlert.success('提示', '操作成功');
this.reload();
......@@ -352,8 +396,16 @@ class RiskModel extends Component {
);
};
bindEquips = (riskSourceId, body) =>{
bindEquipAction(riskSourceId, body).then(
bindEquipIndexs = (fmeaId, equipIndexs) => {
let equipmentPointIds = [];
let param = {};
equipIndexs.map(item => {
equipmentPointIds.push(item.equipIndexId);
param.equipmentId = item.equipmentId;
});
param.fmeaId = fmeaId;
param.equipmentPointIds = equipmentPointIds;
bindEquipIndexAction(param).then(
data => {
AmosAlert.success('提示', '操作成功');
this.reload();
......@@ -471,52 +523,56 @@ class RiskModel extends Component {
// }
getContext = (modelFlag, toolBarFlag) => {
let { riskSourceId } = this.state;
let { riskSourceId, treeNodeType, fmeaId } = this.state;
if (modelFlag === 'risk'){
let { id } = this.state.node;
if (toolBarFlag){
if (toolBarFlag === '1'){//新增
return <RiskSourceModel parentId={id} ref={component =>this.model = component} /> ;
return <RiskSourceModel parentId={id} ref={component =>this.model = component} treeNodeType={treeNodeType} /> ;
} else {
return <RiskSourceModel selectedRow={this.state.node} ref={component => this.model = component} />;
return <RiskSourceModel selectedRow={this.state.node} ref={component => this.model = component} treeNodeType={treeNodeType} />;
}
}
} else if (modelFlag === 'fmea'){
if (toolBarFlag){
if (toolBarFlag === '1'){//新增
return <FmeaModel ref={component => this.model = component} /> ;
} else {
return <RiskFactorModel ref={component => this.model = component} /> ;
} else if (this.fmeaRef) {
const { selectedRows } = this.fmeaRef.state;
return <FmeaModel {...selectedRows[0]} ref={component =>this.model = component} />;
return <EvaluationModel {...selectedRows[0]} ref={component =>this.model = component} />;
}
}
} else if (modelFlag === 'point'){
if (toolBarFlag){
if (toolBarFlag === '1'){//新增
return <PointModel riskSourceId={riskSourceId} ref={component =>this.model = component} /> ;
} else {
return <PointModel fmeaId={fmeaId} ref={component =>this.model = component} bindPointsCallback={this.bindPointsCallback} /> ;
} else if (this.pointRef) {
const { selectedRows } = this.pointRef.state;
return <PointModel {...selectedRows[0]} riskSourceId={riskSourceId} ref={component => this.model = component} /> ;
return <PointModel {...selectedRows[0]} fmeaId={fmeaId} ref={component => this.model = component} bindPointsCallback={this.bindPointsCallback} /> ;
}
}
} else if (modelFlag === 'equip'){
if (toolBarFlag){
if (toolBarFlag === '1'){//新增
return <EquipModel riskSourceId={riskSourceId} ref={component => this.model = component} /> ;
} else {
return <EquipModel bindEquipIndexCallback={this.bindEquipIndexCallback} fmeaId={fmeaId} riskSourceId={riskSourceId} ref={component => this.model = component} /> ;
} else if (this.equipRef) {
const { selectedRows } = this.equipRef.state;
return <EquipModel {...selectedRows[0]} riskSourceId={riskSourceId} ref={component =>this.model = component} /> ;
return <EquipModel {...selectedRows[0]} bindEquipIndexCallback={this.bindEquipIndexCallback} fmeaId={fmeaId} riskSourceId={riskSourceId} ref={component =>this.model = component} /> ;
}
}
}
};
getModalHeader =(modelFlag)=>{
getModalHeader =(modelFlag, toolBarFlag)=>{
let header = '';
if (modelFlag === 'risk'){
header = '添加风险层级';
} else if (modelFlag === 'fmea'){
if (toolBarFlag === '4') {
header = '风险评价';
} else {
header = '添加危险因素';
}
} else if (modelFlag === 'point'){
header = '添加关联巡检点';
} else if (modelFlag === 'equip'){
......@@ -524,6 +580,7 @@ class RiskModel extends Component {
}
return header;
}
// tree列表上右键事件
onRightClick = e => {
this.setState({
......@@ -534,7 +591,7 @@ class RiskModel extends Component {
}
//树按钮点击事件
onButtonClick =(value)=>{
onButtonClick = (value) => {
let { id } = this.state.node;
let childrenLength = 0;
let idsArry = [];
......@@ -545,10 +602,15 @@ class RiskModel extends Component {
idsArry.push(item.props.id);
});
}
if ( value === '1'){
this.setState({ modal: true, modelFlag: 'risk',toolBarFlag: '1' });
} else if ( value === '2'){
this.setState({ modal: true, modelFlag: 'risk',toolBarFlag: '2' });
if (value === '1') {
getTreeNodeTypeAction(id).then(data => {
this.setState({ modal: true, modelFlag: 'risk', toolBarFlag: '1', treeNodeType: data });
});
} else if (value === '2') {
getTreeNodeTypeAction(id).then(data => {
this.setState({ modal: true, modelFlag: 'risk', toolBarFlag: '2', treeNodeType: data });
});
} else {
this.riskSourceDelete(idsArry, childrenLength);
}
......@@ -556,6 +618,7 @@ class RiskModel extends Component {
getNodeTreeRightClickMenu = () => {
let { pageX, pageY } = { ...this.state.rightClickNodeTreeItem };
let { isRegion } = this.state.node;
const height = document.body.offsetHeight;
let overHeight = height - (pageY + 120);
overHeight > 0 ? '' : pageY = height - 120;
......@@ -565,13 +628,13 @@ class RiskModel extends Component {
top: `${pageY - 45}px`,
backgroundColor: '#ffffff',
border: 'solid',
height: '105px',
height: isRegion === 'TRUE' ? '105px' : '70px',
borderWidth: '1px',
borderColor: '#c9c9c9'
};
const menu = (
<div style={tmpStyle}>
<Button icon={<BizIcon icon="tianjia" />} onClick={()=>this.onButtonClick('1')} className='risk-model-button' transparent>添加</Button>
{isRegion === 'TRUE' && <Button icon={<BizIcon icon="tianjia" />} onClick={()=>this.onButtonClick('1')} className='risk-model-button' transparent>添加</Button>}
<Button icon={<BizIcon icon="xiugai" />} onClick={()=>this.onButtonClick('2')} className='risk-model-button' transparent>编辑</Button>
<Button icon={<BizIcon icon="shanchu" />} onClick={()=>this.onButtonClick('3')} className='risk-model-button' transparent>删除</Button>
</div>
......@@ -585,29 +648,38 @@ class RiskModel extends Component {
autoExpandParent: false
});
}
onSelect =(selectedKeys,e)=>{
this.setState({
isRegion: e.node.props.isRegion,
node: e.node.props,
riskSourceId: e.node.props.id,
pageX: e.nativeEvent.pageX,
pageY: e.nativeEvent.pageY,
selectedKeys: (e.node.props.id + '').split(','),
searchParam: [{ name: 'riskSourceId',value: e.node.props.id,type: '' }]
searchParam: [{ name: 'riskSourceId',value: e.node.props.id,type: '' }],
activeKey: '1'
}, () => this.questStatistiscData(this.pageConfig));
this.refeshRiskSourceDetail(e.node.props.id);
}
getTreeIcon =(props)=>{
let { pos } = props;
let arry = pos ? pos.split('-') : [];
let length = arry.length;
if (length === 2){
let { isRegion, pos } = props;
// let arry = pos ? pos.split('-') : [];
// let length = arry.length;
// if (length === 2){
// return <BizIcon icon="shu-changqu" />;
// } else if (length === 3){
// return <BizIcon icon="shu-zhukonglou" />;
// } else if (length === 4){
// return <BizIcon icon="shu-louceng" />;
// } else {
// return '';
// }
if (isRegion === 'TRUE') {
return <BizIcon icon="shu-changqu" />;
} else if (length === 3){
return <BizIcon icon="shu-zhukonglou" />;
} else if (length === 4){
return <BizIcon icon="shu-louceng" />;
} else {
return '';
return <BizIcon icon="shu-louceng" />;
}
}
......@@ -642,9 +714,40 @@ class RiskModel extends Component {
rightClickNodeTreeItem ? this.setState({ rightClickNodeTreeItem: null }) : '';
}
fmeaItemDetailCallback = (fmeaId) => {
console.log('fmeaId =========== ', fmeaId);
this.setState({ fmeaId, showRelationObj: true, activeKey: '2' }, () => this.questStatistiscData(this.pageConfig));
}
closeTab = (activeKey) => {
console.log('~~~~~~~~close tab button is clicked');
}
render() {
let { activeKey,subActiveKey, fmeaData, fmeaDataTotalNum,pointData, pointDataTotalNum ,riskSourceId,
equipData, equipDataTotalNum,modelFlag, modal, toolBarFlag, code, level, rpni ,treeData, expandedKeys, selectedKeys,autoExpandParent } = this.state;
let {
activeKey,
subActiveKey,
fmeaData,
fmeaDataTotalNum,
pointData,
pointDataTotalNum,
riskSourceId,
equipData,
equipDataTotalNum,
modelFlag,
modal,
toolBarFlag,
code,
level,
rpni,
treeData,
expandedKeys,
selectedKeys,
autoExpandParent,
isRegion,
fmeaId,
showRelationObj
} = this.state;
return (
<div className='risk-model'>
<div className='risk-level-map'>
......@@ -694,42 +797,53 @@ class RiskModel extends Component {
</div>
</div>
<div className='risk-model-tab'>
{ isRegion === 'TRUE' ?
<div style={{ paddingTop: '50px' }} >
<RiskSourceModel selectedRow={this.state.node} disabled={true} />
</div>
:
<Tabs
activeKey={activeKey}
type="card"
onTabClick={this.onTabClick}
tabBarExtraContent={this.getToolBar(activeKey,this)}
tabBarExtraContent={this.getToolBar(activeKey, this)}
hideAdd
type="editable-card"
onEdit={this.closeTab}
>
<TabPane tab={<div>FMEA</div>} key="1">
<FmeaTable riskSourceId={riskSourceId} dataList={fmeaData} totalCount={fmeaDataTotalNum} fetchData={this.questStatistiscData} ref={component =>this.fmeaRef = component} />
<TabPane tab={'FMEA'} key="1" hideClose >
<FmeaTable riskSourceId={riskSourceId} dataList={fmeaData} totalCount={fmeaDataTotalNum} fetchData={this.questStatistiscData} ref={component =>this.fmeaRef = component} fmeaItemDetailCallback={this.fmeaItemDetailCallback} />
</TabPane>
<TabPane tab={<div>关联对象</div>} key="2">
{ true &&
<TabPane tab={'关联对象'} key="2" >
<Tabs
activeKey={subActiveKey}
type="card"
onTabClick={this.onSubTabClick}
>
<TabPane tab={<div>巡检点</div>} key="2-1">
<AssociatedPointTable riskSourceId={riskSourceId} dataList={pointData} totalCount={pointDataTotalNum} fetchData={this.questStatistiscData} ref={component =>this.pointRef = component} />
<AssociatedPointTable fmeaId={fmeaId} dataList={pointData} totalCount={pointDataTotalNum} fetchData={this.questStatistiscData} ref={component =>this.pointRef = component} />
</TabPane>
<TabPane tab={<div>设备</div>} key="2-2">
<AssociatedEquipTable riskSourceId={riskSourceId} dataList={equipData} totalCount={equipDataTotalNum} fetchData={this.questStatistiscData} ref={component => this.equipRef = component} />
<AssociatedEquipTable fmeaId={fmeaId} dataList={equipData} totalCount={equipDataTotalNum} fetchData={this.questStatistiscData} ref={component => this.equipRef = component} />
</TabPane>
</Tabs>
</TabPane>
</TabPane>}
</Tabs>
}
</div>
<Modal
header={this.getModalHeader(modelFlag)}
header={this.getModalHeader(modelFlag, toolBarFlag)}
visible={modal}
className="risk-model-model"
destroyContent
width='50%'
width={modelFlag === 'equip' ? '70%' : '50%'}
content={this.getContext(modelFlag, toolBarFlag)}
onCancel={() => this.cancel()}
onOk={() => this.onOk(modelFlag)}
onOk={() => this.onOk(modelFlag, toolBarFlag)}
okText="确定"
cancelText="取消"
outterClosable={false}
/>
{this.getNodeTreeRightClickMenu()}
</div>
......
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import AmosGridTable from './../../../common/tableComponent/table/AmosGridTable';
import { bindEquipListAction } from '../../../../../services/preControlService';
import FireEquipTable from './FireEquipTable'
import EquipTable from './EquipTable'
import { bindEquipListAction, getBindEquipIndexAction } from '../../../../../services/preControlService';
import FireEquipTable from './FireEquipTable';
import EquipTable from './EquipTable';
import FireEquipIndexTable from './FireEquipIndexTable';
/**
* 关联对象-设备
......@@ -22,19 +21,32 @@ class EquipModel extends Component {
selectedRows: [],
selectedRowKeys: [],
selects: [],
dataList:[],
searchParam:{},
selectData:[]
dataList: [],
searchParam: {},
selectData: []
};
}
componentWillMount = () => {
let { eId } = {...this.props};
let { eId } = { ...this.props };
eId && this.setState({ eId });
};
setParamAndSearch =(param)=>{
this.setState({searchParam:param},() => this.questStatistiscData());
this.setState({ searchParam: param },() => this.questStatistiscData());
}
setSelectData =(selectedRowKeys, fmeaId, equipmentId) => {
let { selectData } = this.state;
let index = selectData.findIndex(item => item.equipmentId === equipmentId);
while (index >= 0){//先删除
selectData.splice(index, 1);
index = selectData.findIndex(item => item.equipmentId === equipmentId);
}
selectedRowKeys.map(e => {//再新增
selectData.push({ fmeaId, equipmentId, equipIndexId: e });
});
this.setState({ selectData, selects: selectedRowKeys });
}
questStatistiscData = param => {
......@@ -42,57 +54,73 @@ class EquipModel extends Component {
this.queryBindEquip(riskSourceId, equipmentId, fname);
}
queryBindEquip =(riskSourceId, equipmentId,fname )=>{
queryBindEquip = (riskSourceId, equipmentId, fname) => {
equipmentId && bindEquipListAction(riskSourceId, equipmentId,0,-1,fname).then(data=>{//查询巡检点项
let { selectData } = this.state;
let content = data.content;//内容
if(!fname){
if (!fname){
let fireEquip = content.filter(item => item.isBound === 'bound');//已经选择的行数据
let selects = fireEquip.map(e=>{//已经选择的id集合
return e.id;
});
//按照装备删除,之前已经有的选择数据
let index = selectData.findIndex(item => item.equipmentId === equipmentId);
while( index >= 0){//先删除
while (index >= 0){//先删除
selectData.splice(index, 1);
index = selectData.findIndex(item => item.equipmentId === equipmentId);
};
}
fireEquip.map(e=>{//再新增
selectData.push({riskSourceId: riskSourceId, equipmentId: equipmentId, fireEquipmentId: e.id});//所有双击过的数据库查询出的绑定关系
selectData.push({ riskSourceId, equipmentId, fireEquipmentId: e.id });//所有双击过的数据库查询出的绑定关系
});
this.setState({ dataList: content,totalCount: data.totalElements, selects, selectData, equipmentId: equipmentId });
}else{
this.setState({ dataList: content,totalCount: data.totalElements, selects, selectData, equipmentId });
} else {
this.setState({ dataList: content,totalCount: data.totalElements });
}
});
}
setSelectData =(selectedRowKeys,riskSourceId,equipmentId)=>{
queryBindEquipIndex = (fmeaId, equipmentId, fname) => {
fmeaId && equipmentId && getBindEquipIndexAction(fmeaId, equipmentId, 0, 10000, fname).then(data => {
console.log(data);
let { selectData } = this.state;
let content = data.content;//内容
if (!fname){
let fireEquip = content.filter(item => item.isBound === 'bound');//已经选择的行数据
let selects = fireEquip.map(e=>{//已经选择的id集合
return e.id;
});
//按照装备删除,之前已经有的选择数据
let index = selectData.findIndex(item => item.equipmentId === equipmentId);
while( index >= 0){//先删除
while (index >= 0){//先删除
selectData.splice(index, 1);
index = selectData.findIndex(item => item.equipmentId === equipmentId);
};
selectedRowKeys.map(e=>{//再新增
selectData.push({riskSourceId: riskSourceId, equipmentId: equipmentId, fireEquipmentId: e});
}
fireEquip.map(e=>{//再新增
selectData.push({ fmeaId, equipmentId, equipIndexId: e.id });//所有双击过的数据库查询出的绑定关系
});
this.setState({ indexDataList: content, indexTotalCount: data.totalElements, selects, selectData, equipmentId });
} else {
this.setState({ indexDataList: content, indexTotalCount: data.totalElements });
}
});
this.setState({ selectData, selects:selectedRowKeys });
}
render() {
let { riskSourceId } = this.props;
let {dataList ,totalCount, equipmentId ,selects, eId } = this.state;
let { riskSourceId, bindEquipIndexCallback, fmeaId } = this.props;
let { dataList, totalCount, equipmentId, selects, eId, indexTotalCount, indexDataList } = this.state;
return (
<div className="equip-model">
<EquipTable riskSourceId = {riskSourceId} equipmentId= {eId} fetchData = {this.queryBindEquip}/>
<FireEquipTable riskSourceId = {riskSourceId} equipmentId = {equipmentId} selects ={selects} dataList={dataList} totalCount ={totalCount} callBack = {this.setSelectData} setParamAndSearch ={this.setParamAndSearch} />
<EquipTable riskSourceId={riskSourceId} equipmentId={eId} fetchData={this.queryBindEquip} />
<FireEquipTable fmeaId={fmeaId} equipmentId={equipmentId} selects={selects} dataList={dataList} totalCount={totalCount} setParamAndSearch={this.setParamAndSearch} fetchData={this.queryBindEquipIndex} />
<FireEquipIndexTable bindEquipIndexCallback={bindEquipIndexCallback} riskSourceId={riskSourceId} equipmentId={equipmentId} selects={selects} dataList={indexDataList} totalCount={indexTotalCount} callBack={this.setSelectData} setParamAndSearch={this.setParamAndSearch} />
</div>
);
}
}
EquipModel.propTypes = {
bindEquipIndexCallback: PropTypes.func,
riskSourceId: PropTypes.any,
fmeaId: PropTypes.number
};
export default EquipModel;
......@@ -2,8 +2,7 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import AmosGridTable from './../../../common/tableComponent/table/AmosGridTable';
import { getEquipmentListAction } from '../../../../../services/ledgerService';
import { bindEquipListAction } from '../../../../../services/preControlService';
import { Input } from 'amos-framework';
import { Input, Button } from 'amos-framework';
import BizIcon from './../../../../common/icon/BizIcon';
const getEquipColumns = () => {
......@@ -46,11 +45,23 @@ class EquipTable extends Component {
};
}
componentWillMount = () => {
let { equipmentId } = {...this.props};
equipmentId && this.setState({ searchParam:[{'name':'id', 'value':equipmentId}] ,equipmentId });
let { equipmentId } = { ...this.props };
equipmentId && this.setState({ searchParam: [{ 'name': 'id', 'value': equipmentId }] ,equipmentId });
};
onRowClick =(record, index, event) => {
let { fetchData, riskSourceId } = this.props;
let equimentId = record.id;
this.setState({ equimentId: record.id, riskSourceId });
fetchData(riskSourceId, equimentId,'');
}
onChange = (e,value) =>{
let searchParam = [{ name: e, value, type: 'LIKE' }];
this.setState({ searchParam ,name: value });
}
/**
* 分页设置参数
*/
......@@ -94,24 +105,12 @@ class EquipTable extends Component {
);
};
onRowDoubleClick =(record, index, event) => {
let { fetchData, riskSourceId } = this.props;
let equimentId = record.id;
this.setState({equimentId: record.id,riskSourceId: riskSourceId })
fetchData(riskSourceId, equimentId,'');
}
onChange = (e,value) =>{
let searchParam = [{name:e, value:value, type:'LIKE'}];
this.setState({searchParam ,name: value });
}
searchData =()=>{
let { equipmentId,name } = this.state;
let searchParam =[];
name && searchParam.push({name:'name',value:name,type:'LIKE'});
equipmentId && searchParam.push({name:'id', value:equipmentId});
this.setState({ searchParam },()=> this.questStatistiscData({ pageNumber: [this.pageConfig.current]-1,pageSize: this.pageConfig.pageSize}));
let searchParam = [];
name && searchParam.push({ name: 'name',value: name, type: 'LIKE' });
equipmentId && searchParam.push({ name: 'id', value: equipmentId });
this.setState({ searchParam },()=> this.questStatistiscData({ pageNumber: [this.pageConfig.current] - 1, pageSize: this.pageConfig.pageSize }));
}
questStatistiscData = param => {
......@@ -124,9 +123,9 @@ class EquipTable extends Component {
this.queryEquipPage(searchParam, pageNumber, pageSize);
}
queryEquipPage = (searchParam, pageNumber, pageSize) =>{
getEquipmentListAction(searchParam, pageNumber, pageSize).then(data =>{
this.setState({ dataList:data.content, totalCount:data.totalElements });
queryEquipPage = (searchParam, pageNumber, pageSize) => {
getEquipmentListAction(searchParam, pageNumber, pageSize).then(data => {
this.setState({ dataList: data.content, totalCount: data.totalElements });
});
}
......@@ -135,9 +134,9 @@ class EquipTable extends Component {
let defaultPageConfig = this.pageConfig;
return (
<div className="equip-model-equip">
<div className ='equip-model-equip-input' >
<Input value={name} placeholder = "请输入设备名称" onChange={e => this.onChange('name', e.target.value)} />&nbsp;&nbsp;&nbsp;
<BizIcon icon="sousuo" onClick={this.searchData}/>
<div className='equip-model-equip-input' >
<Input value={name} placeholder="请输入设备名称" onChange={e => this.onChange('name', e.target.value)} />&nbsp;&nbsp;&nbsp;
<Button title="搜索" icon={<BizIcon icon="sousuo" />} transparent onClick={this.searchData} />
</div>
<div className="equip-model-equip-table">
<AmosGridTable
......@@ -147,12 +146,12 @@ class EquipTable extends Component {
dataList={dataList}
totals={totalCount}
getTableDataAction={this.questStatistiscData}
selectedRowKeys = {selectedRowKeys}
selectedRowKeys={selectedRowKeys}
getSelectedRows={this.getSelectedRows}
rowClassName={this.getRowClassName}
setPageConfig={this.setPageConfig}
defaultPageConfig={defaultPageConfig}
onRowClick={this.onRowDoubleClick}
onRowClick={this.onRowClick}
isChecked={isChecked}
/>
</div>
......
import React, { Component } from 'react';
import { Form, Input, Select, Divider } from 'amos-framework';
import { accidentTypeNoPageAction, queryRiskFactorNoPageAction, queryEvaModelAction, queryAllRiskLevelAction } from '../../../../../services/preControlService';
const FormItem = Form.Item;
const Option = Select.Option;
const TextArea = Input.TextArea;
/**
* 危险因素评价页面
*/
class EvaluationModel extends Component {
constructor(props) {
super(props);
this.state = {
searchParam: [],
form: {
riskFactorsId: '',
accidentTypeId: '',
influence: '',
evaluationSid: '',
evaluationOid: '',
evaluationDid: '',
evaluationS: '',
evaluationO: '',
evaluationD: '',
engineering: '',
train: '',
management: '',
protection: '',
disposal: '',
rpni: 0
},
riskFactorData: [],
accidentTypeData: [],
sData: [],
dData: [],
oData: [],
rules: {
riskFactorsId: [{ required: true, message: '危险因素不能为空' }],
accidentTypeId: [{ required: true, message: '事故类型不能为空' }],
influence: [{ required: true, message: '失效影响不能为空' }],
evaluationSid: [{ required: true, message: '严重度Si不能为空' }],
evaluationOid: [{ required: true, message: '故障频数Oi不能为空' }],
evaluationDid: [{ required: true, message: '探测度Di不能为空' }]
},
riskLevelData: []
};
}
componentWillMount = () => {
let { form } = this.state;
Object.assign(form, { ...this.props });
this.setState({ form });
};
componentDidMount = () => {
this.getAccidentTypeData();
this.getRiskFactorData();
this.getEvaModel('');
this.getRiskLevel();
};
onSelectChange = (key, value, item) => {
const { form } = this.state;
form[key] = value;
let coefficient = (item || {}).coefficient;
if (key === 'evaluationOid') {
form['evaluationO'] = coefficient;
} else if (key === 'evaluationSid') {
form['evaluationS'] = coefficient;
} else if (key === 'evaluationDid') {
form['evaluationD'] = coefficient;
}
this.setState({ form });
};
getAccidentTypeData = () => {
accidentTypeNoPageAction().then(data => {
this.setState({ accidentTypeData: data });
});
};
getRiskFactorData = () => {
queryRiskFactorNoPageAction().then(data => {
this.setState({ riskFactorData: data });
});
};
getEvaModel = searchParam => {
queryEvaModelAction(searchParam).then(data => {
this.setState({ sData: data.S, dData: data.D, oData: data.O });
});
};
getRiskLevel = () => {
queryAllRiskLevelAction().then(data => {
this.setState({ riskLevelData: data });
});
}
confiremLevel = () => {
let { riskLevelData, form } = this.state;
let rpni = form.evaluationS * form.evaluationO * form.evaluationD;
let target = {};
target = riskLevelData.filter(level => {
if (rpni > level.downLimit && rpni <= level.topLimit) {
return true;
}
});
form.rpni = rpni;
return target[0] && target[0].name;
}
reload = () => {
this.setState({
form: {
riskFactorsId: '',
accidentTypeId: '',
influence: '',
evaluationSid: '',
evaluationOid: '',
evaluationDid: '',
evaluationS: '',
evaluationO: '',
evaluationD: '',
engineering: '',
train: '',
management: '',
protection: '',
disposal: ''
}
});
};
render() {
const { form, rules, sData, dData, oData } = this.state;
const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
className: 'colspanlab'
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 14 },
className: 'colspan'
}
};
return (
<div className="fmea-model">
<Form model={form} rules={rules} ref={component => this.form = component}>
<span className="fmea-item-span">风险评价:</span>
<Divider />
<FormItem label={<span>风险评价准则</span>} className="fmea-item-risk-factor" field="" {...formItemLayout} />
<div className="fmea-model-evaluation">
<FormItem label={<span>S准则</span>} field="evaluationSid" {...formItemLayout}>
<Select
className="fmea-model-select"
data={sData}
renderOption={item => <Option value={parseInt(item.id)}>{item.coefficient}-{item.influence}</Option>}
value={parseInt(form.evaluationSid)}
onChange={(e, item) => this.onSelectChange('evaluationSid', e, item)}
/>
</FormItem>
<FormItem label={<span>O准则</span>} field="evaluationOid" {...formItemLayout}>
<Select
className="fmea-model-select"
data={oData}
renderOption={item => (
<Option value={parseInt(item.id)}>
{item.coefficient}-{item.influence}-{item.describe}
</Option>
)}
value={form.evaluationOid}
onChange={(e, item) => this.onSelectChange('evaluationOid', e, item)}
/>
</FormItem>
<FormItem label={<span>D准则</span>} className="fmea-item-evaluationDid" field="evaluationDid" {...formItemLayout}>
<Select
className="fmea-model-select"
data={dData}
renderOption={item => (
<Option value={parseInt(item.id)}>
{item.coefficient}-{item.describe}
</Option>
)}
value={form.evaluationDid}
onChange={(e, item) => this.onSelectChange('evaluationDid', e, item)}
/>
</FormItem>
</div>
<FormItem label={<span>风险评价结果</span>} className="fmea-item-influence" field="" {...formItemLayout}>
<div style={{ display: 'flex', lineHeight: '32px' }}>
<div style={{ paddingRight: '15px' }}>S准则:{form.evaluationS}</div>
<div style={{ paddingRight: '15px' }}>O准则:{form.evaluationO}</div>
<div style={{ paddingRight: '15px' }}>D准则:{form.evaluationD}</div>
<div style={{ paddingRight: '15px' }}>RPNI{form.evaluationS * form.evaluationO * form.evaluationD}</div>
</div>
</FormItem>
<FormItem label={<span>风险等级</span>} className="fmea-item-influence" field="" {...formItemLayout}>
<div style={{ lineHeight: '32px' }}>{this.confiremLevel()}</div>
</FormItem>
<span className="fmea-item-span">责任人:</span>
<FormItem label={<span>责任人</span>} className="fmea-item-influence" field="identifyUser" {...formItemLayout}>
<Input className="risk_factor_input" value={form.influence} onChange={e => this.onSelectChange('influence', e.target.value)} />
</FormItem>
<Divider />
<span className="fmea-item-span">管控措施:</span>
<Divider />
<FormItem label={<span>工程措施</span>} className="fmea-item-display" field="engineering" {...formItemLayout}>
<TextArea className="fmea-input_item" rows={4} value={form.engineering} onChange={e => this.onSelectChange('engineering', e.target.value)} />
</FormItem>
<FormItem label={<span>培训教育</span>} className="fmea-item-display" field="train" {...formItemLayout}>
<TextArea className="fmea-input_item" rows={4} value={form.train} onChange={e => this.onSelectChange('train', e.target.value)} />
</FormItem>
<FormItem label={<span>管理措施</span>} className="fmea-item-display" field="management" {...formItemLayout}>
<TextArea className="fmea-input_item" rows={4} value={form.management} onChange={e => this.onSelectChange('management', e.target.value)} />
</FormItem>
<FormItem label={<span>个体防护</span>} className="fmea-item-display" field="protection" {...formItemLayout}>
<TextArea className="fmea-input_item" rows={4} value={form.protection} onChange={e => this.onSelectChange('protection', e.target.value)} />
</FormItem>
<FormItem label={<span>应急处置</span>} className="fmea-item-display" field="disposal" {...formItemLayout}>
<TextArea className="fmea-input_item" rows={4} value={form.disposal} onChange={e => this.onSelectChange('disposal', e.target.value)} />
</FormItem>
</Form>
</div>
);
}
}
export default EvaluationModel;
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import AmosGridTable from './../../../common/tableComponent/table/AmosGridTable';
import { Input, Button } from 'amos-framework';
import BizIcon from './../../../../common/icon/BizIcon';
const getAssoEquipColumns = () => {
return [
{
title: '编号',
dataIndex: 'code',
key: 'code',
width: '30%'
},
{
title: '名称',
dataIndex: 'name',
key: 'name',
width: '70%'
}
];
};
/**
* 关联对象-配套设备
*/
class FireEquipIndexTable extends Component {
constructor(props) {
super(props);
this.pageConfig = {
current: 1,
pageSize: 10
};
this.state = {
pagination: false,
isChecked: true,
selectedRows: [],
selectedRowKeys: [],
dataList: []
};
}
onChange = (e,value) => {
this.setState({ fname: value });
}
/**
* 分页设置参数
*/
setPageConfig = ({ pageSize, current }) => {
if (pageSize !== undefined) {
this.pageConfig.pageSize = pageSize;
}
if (current !== undefined) {
this.pageConfig.pageNumber = current;
}
};
/**
* 获取表格所选则的行数据
*/
getSelectedRows = (selectedRows, selectedRowKeys) => {
this.setState({ selectedRows, selectedRowKeys });
let { fmeaId, equipmentId, callBack } = this.props;
callBack(selectedRowKeys, fmeaId, equipmentId);
};
getRowClassName = (record, index) => {
let highlight = this.highlight;
if (highlight && record.id === highlight) {
return 'highlight-row';
} else {
return 'normal-row';
}
}
/**
* 获取表格刷新方法
*/
reload = r => {
this.setState(
{
reload: () => {
r();
this.setState({ selectedRows: [], selectedRowKeys: [] });
}
},
r()
);
};
clearSelectedRows = () => {
this.setState({ selectedRows: [], selectedRowKeys: [] });
};
reloadPage = () => {
this.clearSelectedRows();
this.state.reload();
};
searchData = () => {
let {riskSourceId, equipmentId, setParamAndSearch } = this.props;
let { fname } = this.state;
setParamAndSearch({ riskSourceId, equipmentId, fname });
}
save = () => {
this.props.bindEquipIndexCallback();
}
render() {
let { pagination, isChecked, fname } = this.state;
let { dataList, totalCount, selects } = this.props;
let defaultPageConfig = this.pageConfig;
return (
<div className="equip-model-fire">
<div className='equip-model-fire-input' >
<Input value={fname} placeholder="请输名称" onChange={e => this.onChange('fname', e.target.value)} />&nbsp;&nbsp;&nbsp;
<Button title="搜索" icon={<BizIcon icon="sousuo" />} transparent onClick={this.searchData} />
<Button title="保存" icon={<BizIcon icon="baocun" />} transparent onClick={this.save} />
</div>
<div className="equip-model-fire-table">
<AmosGridTable
columns={getAssoEquipColumns()}
callBack={this.reload}
isPageable={pagination}
dataList={dataList}
totals={totalCount}
getTableDataAction={()=>{}}
selectedRowKeys={selects}
getSelectedRows={this.getSelectedRows}
rowClassName={this.getRowClassName}
isChecked={isChecked}
/>
</div>
</div>
);
}
}
FireEquipIndexTable.propTypes = {
bindEquipIndexCallback: PropTypes.func,
fmeaId: PropTypes.number
};
export default FireEquipIndexTable;
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import AmosGridTable from './../../../common/tableComponent/table/AmosGridTable';
import { Input } from 'amos-framework';
import { Input, Button } from 'amos-framework';
import BizIcon from './../../../../common/icon/BizIcon';
const getAssoEquipColumns = () => {
......@@ -34,13 +34,24 @@ class FireEquipTable extends Component {
};
this.state = {
pagination: false,
isChecked: true,
isChecked: false,
selectedRows: [],
selectedRowKeys: [],
dataList: []
};
}
onChange = (e,value) =>{
this.setState({ fname: value });
}
onRowClick =(record) => {
let { fetchData, fmeaId } = this.props;
let equimentId = record.id;
this.setState({ equimentId: record.id, fmeaId });
fetchData(fmeaId, equimentId, '');
}
/**
* 分页设置参数
*/
......@@ -59,7 +70,7 @@ class FireEquipTable extends Component {
getSelectedRows = (selectedRows, selectedRowKeys) => {
this.setState({ selectedRows, selectedRowKeys });
let { riskSourceId, equipmentId, callBack } = this.props;
callBack(selectedRowKeys,riskSourceId,equipmentId);
// callBack(selectedRowKeys,riskSourceId,equipmentId);
};
getRowClassName = (record, index) => {
......@@ -95,26 +106,21 @@ class FireEquipTable extends Component {
this.state.reload();
};
onChange = (e,value) =>{
this.setState({fname: value})
}
searchData =()=>{
let {riskSourceId, equipmentId, setParamAndSearch } = this.props;
let { fname } = this.state;
setParamAndSearch({riskSourceId:riskSourceId, equipmentId :equipmentId,fname: fname});
setParamAndSearch({ riskSourceId, equipmentId, fname });
}
render() {
let { pagination, isChecked, fname } = this.state;
let { dataList, totalCount, selects } = this.props;
let defaultPageConfig = this.pageConfig;
return (
<div className="equip-model-fire">
<div className ='equip-model-fire-input' >
<Input value={fname} placeholder = "请输名称" onChange={e => this.onChange('fname', e.target.value)} />&nbsp;&nbsp;&nbsp;
<BizIcon icon="sousuo" onClick={this.searchData}/>
<div className='equip-model-fire-input' >
<Input value={fname} placeholder="请输名称" onChange={e => this.onChange('fname', e.target.value)} />&nbsp;&nbsp;&nbsp;
<Button title="搜索" icon={<BizIcon icon="sousuo" />} transparent onClick={this.searchData} />
</div>
<div className="equip-model-fire-table">
<AmosGridTable
......@@ -124,9 +130,10 @@ class FireEquipTable extends Component {
dataList={dataList}
totals={totalCount}
getTableDataAction={()=>{}}
selectedRowKeys = {selects}
selectedRowKeys={selects}
getSelectedRows={this.getSelectedRows}
rowClassName={this.getRowClassName}
onRowClick={this.onRowClick}
isChecked={isChecked}
/>
</div>
......@@ -136,6 +143,10 @@ class FireEquipTable extends Component {
}
FireEquipTable.propTypes = {
fmeaId: PropTypes.number,
fetchData: PropTypes.func,
dataList: PropTypes.array,
totalCount: PropTypes.number,
selects: PropTypes.array
};
export default FireEquipTable;
......@@ -2,7 +2,8 @@ import React, { Component } from 'react';
import PropTypes from 'prop-types';
import AmosGridTable from './../../../common/tableComponent/table/AmosGridTable';
import { queryDeptByOrgCodeAction, queryPointPageListAction, queryPointInputPageListAction } from '../../../../../services/preControlService';
import { Select, Checkbox } from 'amos-framework';
import { Select, Checkbox, Button } from 'amos-framework';
import BizIcon from '../../../../common/icon/BizIcon';
const Option = Select.Option;
const CheckboxGroup = Checkbox.Group;
......@@ -42,21 +43,21 @@ class PointModel extends Component {
isChecked: false,
selectedRows: [],
selectedRowKeys: [],
departmentId:'',
departmentId: '',
selects: [],
pointIntemData:[],
pointIntemData: [],
deptData: [],
select: [],
searchParam: [],
selectData:[],//已经配置的关联点项
inputType:''
selectData: [],//已经配置的关联点项
inputType: ''
};
}
componentWillMount = () => {
this.queryDeptByOrgCode();
let { pointId } = {...this.props};
pointId && this.setState({ searchParam:[{'name':'pointId', 'value':pointId}] ,pointId });
let { pointId } = { ...this.props };
pointId && this.setState({ searchParam: [{ 'name': 'pointId', 'value': pointId }] ,pointId });
};
/**
......@@ -102,12 +103,11 @@ class PointModel extends Component {
);
};
onRowDoubleClick =(record, index, event) => {
let searchParam =[];
searchParam.push({name:'pointId',value: record.id});
searchParam.push({name:'riskSourceId',value: this.props.riskSourceId});
this.setState({pointId: record.id})
let searchParam = [];
searchParam.push({ name: 'pointId',value: record.id });
searchParam.push({ name: 'fmeaId',value: this.props.fmeaId });
this.setState({ pointId: record.id });
this.queryPointInputItem(searchParam, record.id,'');
}
......@@ -123,34 +123,34 @@ class PointModel extends Component {
onInputTypeChange = (e, value) => {
let { pointId } = this.state;
let searchParam = [];
searchParam.push({name:'pointId',value: pointId});
searchParam.push({name:'inputType',value: value});
searchParam.push({name:'riskSourceId',value: this.props.riskSourceId});
searchParam.push({ name: 'pointId',value: pointId });
searchParam.push({ name: 'inputType',value });
searchParam.push({ name: 'fmeaId',value: this.props.fmeaId });
this.queryPointInputItem(searchParam,pointId,value);
this.setState({inputType: value});
this.setState({ inputType: value });
};
queryPointInputItem =(searchParam, pointId, value)=>{
let riskSourceId = this.props.riskSourceId;
pointId && queryPointInputPageListAction(searchParam,0,-1).then(data=>{//查询巡检点项
let content = data.content;//内容
if(!value){//全部时才放数据
if (!value){//全部时才放数据
let { selectData } = this.state;
let checkItem = content.filter(item => item.isBound === 'bound');//已经选择的
let selects = checkItem.map(e=>{
return e.inputId;
return e.pointInputitemId;
});
//按照pointId删除,之前已经有的选择数据
let index = selectData.findIndex(item => item.pointId === pointId);
while( index >= 0){//先删除
while ( index >= 0){//先删除
selectData.splice(index, 1);
index = selectData.findIndex(item => item.pointId === pointId);
}
checkItem.map(e=>{//再新增
selectData.push({riskSourceId: riskSourceId, pointId: e.pointId, pointInputitemId: e.inputId});
selectData.push({ riskSourceId, pointId: e.pointId, pointInputitemId: e.pointInputitemId });
});
this.setState({ pointIntemData: content, selects: selects, selectData: selectData });
}else{//选择分类时,不改变选择的全部数据
this.setState({ pointIntemData: content, selects, selectData });
} else {//选择分类时,不改变选择的全部数据
this.setState({ pointIntemData: content });
}
});
......@@ -165,7 +165,7 @@ class PointModel extends Component {
getCheckBox =()=>{
const { pointIntemData } = this.state;
return pointIntemData.map(item =>{
return <Checkbox key={item.inputId} value={item.inputId}>{item.inputName}</Checkbox>;
return <Checkbox key={item.pointInputitemId} value={item.pointInputitemId}>{item.inputName}</Checkbox>;
});
}
......@@ -198,16 +198,19 @@ class PointModel extends Component {
let riskSourceId = this.props.riskSourceId;
let { selectData } = this.state;
let index = selectData.findIndex(item => item.pointId === pointId);
while( index >= 0){
while (index >= 0){
selectData.splice(index, 1);
index = selectData.findIndex(item => item.pointId === pointId);
}
selects.map(e=>{
selectData.push({riskSourceId: riskSourceId, pointId: pointId, pointInputitemId: e});
selectData.push({ riskSourceId, pointId, pointInputitemId: e });
});
this.setState({ selects, selectData });
}
save = () => {
this.props.bindPointsCallback();
}
render() {
let { dataList, totalCount, pagination, isChecked, selectedRowKeys, pointIntemData, departmentId, deptData, selects, pointId, inputType } = this.state;
......@@ -223,7 +226,7 @@ class PointModel extends Component {
renderOption={item => <Option value={item.depmCode}>{item.departmentName}</Option>}
value={departmentId}
defaultOption={<Option value="">全部</Option>}
onChange={ e=> this.onSelectChange('departmentId', e) }
onChange={e=> this.onSelectChange('departmentId', e)}
/>
</div>
<div className="point-model-table">
......@@ -234,7 +237,7 @@ class PointModel extends Component {
dataList={dataList}
totals={totalCount}
getTableDataAction={this.questStatistiscData}
selectedRowKeys = {selectedRowKeys}
selectedRowKeys={selectedRowKeys}
getSelectedRows={this.getSelectedRows}
rowClassName={this.getRowClassName}
setPageConfig={this.setPageConfig}
......@@ -256,9 +259,10 @@ class PointModel extends Component {
<Option value="数字">数字检查项</Option>
<Option value="选择">选择检查项</Option>
</Select>
<Button title="保存" icon={<BizIcon icon="baocun" />} transparent onClick={this.save} />
</div>
<div className="point-model-checkBox">
<CheckboxGroup vertical isCheckall selects ={selects} onChange={selects => this.onCheckBoxChange(pointId,selects)}>
<CheckboxGroup vertical isCheckall selects={selects} onChange={selects => this.onCheckBoxChange(pointId, selects)}>
{this.getCheckBox(pointIntemData)}
</CheckboxGroup>
</div>
......@@ -269,6 +273,7 @@ class PointModel extends Component {
}
PointModel.propTypes = {
fmeaId: PropTypes.number,
bindPointsCallback: PropTypes.func
};
export default PointModel;
import React, { Component } from 'react';
import { Form, Input, Select, Divider, MultiSelect } from 'amos-framework';
import { accidentTypeNoPageAction, queryRiskFactorNoPageAction, queryEvaModelAction } from '../../../../../services/preControlService';
const FormItem = Form.Item;
const Option = Select.Option;
const multiSelectOption = MultiSelect.Option;
/**
* 危险因素
*/
class RiskFactorModel extends Component {
constructor(props) {
super(props);
this.state = {
searchParam: [],
form: {
riskFactorIds: [],
identifyUser: '',
identifyMethod: ''
},
riskFactorData: [],
rules: {
riskFactorIds: [{ required: true, message: '危险因素不能为空' }]
}
};
}
componentWillMount = () => {
let { form } = this.state;
Object.assign(form, { ...this.props });
this.setState({ form });
};
componentDidMount = () => {
this.getRiskFactorData();
};
onSelectChange = (key, value, item) => {
const { form } = this.state;
form[key] = value;
this.setState({ form });
};
onSelectedChange = (value, type) => {
const { form } = this.state;
form[type] = value;
this.setState({ form });
}
getRiskFactorData = () => {
queryRiskFactorNoPageAction().then(data => {
this.setState({ riskFactorData: data });
});
};
reload = () => {
this.setState({
form: {
riskFactorIds: [],
identifyUser: '',
identifyMethod: ''
}
});
};
render() {
const { form, rules, riskFactorData } = this.state;
const formItemLayout = {
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
className: 'colspanlab'
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 14 },
className: 'colspan'
}
};
return (
<div className="fmea-model">
<Form model={form} rules={rules} ref={component => this.form = component}>
<span className="fmea-item-span">基本信息:</span>
<Divider />
<FormItem label={<span>辨识人</span>} className="fmea-item-influence" field="identifyUser" {...formItemLayout}>
<Input className="risk_factor_input" value={form.influence} onChange={e => this.onSelectChange('influence', e.target.value)} />
</FormItem>
<FormItem label={<span>辨识方法</span>} className="fmea-item-influence" field="identifyMethod" {...formItemLayout}>
<Input className="risk_factor_input" value={form.influence} onChange={e => this.onSelectChange('influence', e.target.value)} />
</FormItem>
<span className="fmea-item-span">失危险有害因素:</span>
<Divider />
<FormItem label={<span>危险因素</span>} className="fmea-item-risk-factor" field="riskFactorsId" {...formItemLayout}>
<div className="risk-factor-select" style={{ height: '200px' }} >
<MultiSelect
className="fmea-model-select"
data={riskFactorData}
renderOption={item => <multiSelectOption value={parseInt(item.id)}>{item.name}</multiSelectOption>}
values={form.riskFactorIds}
onChange={(e)=>this.onSelectedChange(e, 'riskFactorIds')}
placeholder='危险因素'
/>
</div>
</FormItem>
</Form>
</div>
);
}
}
export default RiskFactorModel;
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Form, Input, Select, Radio } from 'amos-framework';
import { queryRiskLevelEumListAction } from '../../../../../services/preControlService';
......@@ -6,10 +7,10 @@ const FormItem = Form.Item;
const Option = Select.Option;
const RadioGroup = Radio.Group;
const floorData = [{ id: '1', name: '1层' }, { id: '2', name: '2层' }, { id: '3', name: '3层' }, { id: '4', name: '4层' }, { id: '5', name: '5层' }, { id: '6', name: '6层' }];
/**
* 添加风险层级,编辑及维护
*/
class RiskSourceModel extends Component {
constructor(props) {
super(props);
......@@ -22,7 +23,7 @@ class RiskSourceModel extends Component {
riskLevelId: '',
rpn: 0,
parentId: this.props.parentId,
isRegion: 'FALSE',
isRegion: this.props.treeNodeType === 2 ? 'FALSE' : 'TRUE',
floor3d: '1',
isIndoor: 1,
position3d: ''
......@@ -60,6 +61,23 @@ class RiskSourceModel extends Component {
this.getriskLevelEumData();
};
componentWillReceiveProps = (nextProps) => {
let { form } = this.state;
let { selectedRow } = nextProps;
if (selectedRow) {
form.id = selectedRow.id;
form.name = selectedRow.name;
form.code = selectedRow.code;
form.parentId = selectedRow.parentId;
form.riskLevelId = selectedRow.riskLevelId;
form.rpn = selectedRow.rpn;
form.isRegion = selectedRow.isRegion;
form.position3d = selectedRow.position3d;
form.floor3d = selectedRow.floor3d;
form.isIndoor = selectedRow.isIndoor;
}
this.setState({ form });
}
onSelectChange = (key, value) => {
const { form } = this.state;
form[key] = value;
......@@ -97,6 +115,8 @@ class RiskSourceModel extends Component {
render() {
const { form, rules, riskLevelData } = this.state;
const { treeNodeType, disabled } = this.props;
let showIsRegionSelection = (treeNodeType === 3 || treeNodeType === undefined) && form.isRegion === 'TRUE';
const formItemLayout = {
labelCol: {
xs: { span: 24 },
......@@ -114,10 +134,10 @@ class RiskSourceModel extends Component {
<div>
<Form model={form} rules={rules} ref={component => (this.form = component)}>
<FormItem label={<span>风险名称</span>} field="name" {...formItemLayout}>
<Input className="risk-model-input" required value={form.name} onChange={e => this.onSelectChange('name', e.target.value)} />
<Input disabled={disabled} className="risk-model-input" required value={form.name} onChange={e => this.onSelectChange('name', e.target.value)} />
</FormItem>
<FormItem label={<span>参考编号</span>} field="code" {...formItemLayout}>
<Input className="risk-model-input" required value={form.code} onChange={e => this.onSelectChange('code', e.target.value)} />
<Input disabled={disabled} className="risk-model-input" required value={form.code} onChange={e => this.onSelectChange('code', e.target.value)} />
</FormItem>
<FormItem label={<span>风险等级</span>} field="riskLevelId" {...formItemLayout}>
<Select
......@@ -126,16 +146,18 @@ class RiskSourceModel extends Component {
value={form.riskLevelId}
renderOption={item => <Option value={item.id}>{item.name || item.level}</Option>}
onChange={e => this.onSelectChange('riskLevelId', e)}
disabled={disabled}
/>
</FormItem>
<FormItem label={<span>是否区域</span>} field="isRegion" {...formItemLayout}>
<RadioGroup defaultValue={form.isRegion} onChange={e => this.onSelectChange('isRegion', e)}>
{ showIsRegionSelection && <FormItem label={<span>是否区域</span>} field="isRegion" {...formItemLayout}>
<RadioGroup disabled={disabled} defaultValue={form.isRegion} onChange={e => this.onSelectChange('isRegion', e)}>
<Radio value="FALSE"></Radio>
<Radio value="TRUE"></Radio>
</RadioGroup>
</FormItem>
}
<FormItem label={<span>3维坐标</span>} field="position3d" {...formItemLayout}>
<Input className="risk-model-input" value={form.position3d} onChange={e => this.onSelectChange('position3d', e.target.value)} />
<Input disabled={disabled} className="risk-model-input" value={form.position3d} onChange={e => this.onSelectChange('position3d', e.target.value)} />
</FormItem>
<FormItem label={<span>3维楼层</span>} field="floor3d" {...formItemLayout}>
<Select
......@@ -145,10 +167,11 @@ class RiskSourceModel extends Component {
value={form.floor3d}
renderOption={item => <Option value={item.id}>{item.name}</Option>}
onChange={e => this.onSelectChange('floor3d', e)}
disabled={disabled}
/>
</FormItem>
<FormItem label={<span>是否室内</span>} field="isIndoor" {...formItemLayout}>
<RadioGroup defaultValue={form.isIndoor} onChange={e => this.onSelectChange('isIndoor', e)}>
<RadioGroup disabled={disabled} defaultValue={form.isIndoor} onChange={e => this.onSelectChange('isIndoor', e)}>
<Radio value={0}></Radio>
<Radio value={1}></Radio>
</RadioGroup>
......@@ -159,4 +182,9 @@ class RiskSourceModel extends Component {
}
}
RiskSourceModel.propTypes = {
treeNodeType: PropTypes.number,
parentId: PropTypes.number
};
export default RiskSourceModel;
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