Commit b597e794 authored by taabe's avatar taabe

需求变更:

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