Commit 8914db12 authored by taabe's avatar taabe

优化关联设备指标添加编辑页面

parent e6d5414e
......@@ -148,7 +148,7 @@ export const FasSerUrl = {
bindPointUrl: completePrefix(baseURI, 'api/risksource/bindFmea/pointInputitem'),//巡检点关联
riskSourceRpnCountUrl: completePrefix(baseURI,'api/risksource/rpn/list'), // 查询风险点RPN统计
bindEquipListUrl: completePrefix(baseURI, 'api/risksource/fireequiment/relation/all?equimentId={equimentId}&fname={fname}&pageNumber={page}&pageSize={size}'),//配套设施查询(已绑定及未绑定)
getBindEquipIndexUrl: completePrefix(baseURI, 'api/risksource/listEquipmentPointById?fmeaId={fmeaId}&equimentId={equimentId}&equipmentPointName={equipmentPointName}'),//获取配套设备指标项
getBindEquipIndexUrl: completePrefix(baseURI, 'api/risksource/listEquipmentPointById?fmeaId={fmeaId}&importantEquipId={importantEquipId}&equimentId={equimentId}&equipmentPointName={equipmentPointName}'),//获取配套设备指标项
bindEquipIndexUrl: completePrefix(baseURI, 'api/risksource/bingFmea/equimentPoint'),
deleteBindEquipUrl: completePrefix(baseURI, 'api/risksource/fireequiment/relation/{ids}'),
removeByRSIdAndPIdUrl: completePrefix(baseURI, 'api/risksource/removeByRSIdAndPId'),//删除绑定的设备
......
......@@ -111,8 +111,8 @@ export const bindEquipListAction = (riskSourceId , equimentId, page, size,fname)
return commonGet(formatUrl(FasSerUrl.bindEquipListUrl, { riskSourceId,equimentId,fname,page,size }));
};
export const getBindEquipIndexAction = (fmeaId, equimentId, equipmentPointName) => {
let url = formatUrl(FasSerUrl.getBindEquipIndexUrl, { fmeaId, equimentId, equipmentPointName });
export const getBindEquipIndexAction = (fmeaId, importantEquipId, equimentId, equipmentPointName) => {
let url = formatUrl(FasSerUrl.getBindEquipIndexUrl, { fmeaId, importantEquipId, equimentId, equipmentPointName });
return commonGet(url);
};
......
......@@ -28,13 +28,13 @@ const matchEquipmentTableColumns = self => {
title: '编号',
dataIndex: 'code',
key: 'code',
width: '20%'
width: '15%'
},
{
title: '名称',
dataIndex: 'name',
key: 'name',
width: '25%'
width: '22%'
},
{
title: '建/构筑物',
......@@ -46,7 +46,7 @@ const matchEquipmentTableColumns = self => {
title: '楼层',
dataIndex: 'floor3d',
key: 'floor3d',
width: '5%'
width: '10%'
},
{
title: '房间',
......
......@@ -26,7 +26,7 @@ const equipmentTableColumns = self => {
title: '编号',
dataIndex: 'code',
key: 'code',
width: '15%'
width: '10%'
},
{
title: '名称',
......@@ -44,7 +44,7 @@ const equipmentTableColumns = self => {
title: '位置',
dataIndex: 'address',
key: 'address',
width: '15%'
width: '23%'
},
{
title: '配套设备',
......
......@@ -32,7 +32,7 @@ const fireEquipmentTableColumns = self => {
title: '装备名称',
dataIndex: 'name',
key: 'name',
width: '9%'
width: '8%'
},
{
title: '分类',
......@@ -69,7 +69,7 @@ const fireEquipmentTableColumns = self => {
title: '建/构筑物',
dataIndex: 'riskSourceName',
key: 'riskSourceName',
width: '6%'
width: '8%'
},
{
title: '楼层',
......@@ -81,7 +81,7 @@ const fireEquipmentTableColumns = self => {
title: '房间',
dataIndex: 'room',
key: 'room',
width: '4%'
width: '6%'
},
{
title: '保养周期(月)',
......@@ -99,7 +99,7 @@ const fireEquipmentTableColumns = self => {
title: '品牌',
dataIndex: 'brand',
key: 'brand',
width: '5%'
width: '8%'
},
{
title: '生产日期',
......
......@@ -30,31 +30,31 @@ const fireStationTableColumns = self => {
title: '编号',
dataIndex: 'code',
key: 'code',
width: '15%'
width: '10%'
},
{
title: '名称',
dataIndex: 'name',
key: 'name',
width: '20%'
width: '25%'
},
{
title: '所属区域',
dataIndex: 'riskSourceName',
key: 'riskSourceName',
width: '20%'
width: '25%'
},
{
title: '位置',
dataIndex: 'address',
key: 'address',
width: '30%'
width: '24%'
},
{
title: '配套设备',
dataIndex: '',
key: '',
width: '20%',
width: '10%',
render: (text, record, index) => {
return (
<span>
......
......@@ -25,7 +25,7 @@ const fireTruckTableColumns = self => {
title: '车辆类型',
dataIndex: 'type',
key: 'type',
width: '15%'
width: '10%'
},
{
title: '车辆名称',
......@@ -43,25 +43,25 @@ const fireTruckTableColumns = self => {
title: '发动机号',
dataIndex: 'engineNum',
key: 'engineNum',
width: '10%'
width: '12%'
},
{
title: '厂牌型号',
dataIndex: 'model',
key: 'model',
width: '10%'
width: '13%'
},
{
title: '国别',
dataIndex: 'country',
key: 'country',
width: '10%'
width: '7%'
},
{
title: '所在区域',
dataIndex: 'riskSourceName',
key: 'riskSourceName',
width: '10%'
width: '15%'
},
// {
// title: '车辆状态',
......
......@@ -35,7 +35,7 @@ const fireDetectorTableColumns = self => {
title: '重量',
dataIndex: 'weight',
key: 'weight',
width: '5%'
width: '4%'
},
{
title: '设备状态',
......
......@@ -30,7 +30,7 @@ const fireFoamTableColumns = self => {
title: '编号',
dataIndex: 'code',
key: 'code',
width: '17%'
width: '10%'
},
{
title: '名称',
......@@ -42,19 +42,19 @@ const fireFoamTableColumns = self => {
title: '所属区域',
dataIndex: 'riskSourceName',
key: 'riskSourceName',
width: '20%'
width: '25%'
},
{
title: '位置',
dataIndex: 'address',
key: 'address',
width: '30%'
width: '24%'
},
{
title: '配套设备',
dataIndex: '',
key: '',
width: '20%',
width: '10%',
render: (text, record, index) => {
return (
<span>
......
......@@ -23,7 +23,7 @@ const fireWaterTableColumns = self => {
title: '编号',
dataIndex: 'code',
key: 'code',
width: '10%'
width: '11%'
},
{
title: '名称',
......@@ -41,7 +41,7 @@ const fireWaterTableColumns = self => {
title: '楼层',
dataIndex: 'floor3d',
key: 'floor3d',
width: '10%'
width: '5%'
},
{
title: '房间',
......@@ -59,7 +59,7 @@ const fireWaterTableColumns = self => {
title: '配套设备',
dataIndex: '',
key: '',
width: '10%',
width: '8%',
render: (text, record, index) => {
return (
<span>
......
......@@ -21,8 +21,8 @@ const getColumns = () => {
},
{
title: '所属重点设备',
dataIndex: 'importantEquip',
key: 'importantEquip',
dataIndex: 'importantEquipName',
key: 'importantEquipName',
width: '25%',
className: 'uant-table-thead'
},
......@@ -31,7 +31,38 @@ const getColumns = () => {
dataIndex: 'equipmentPointNames',
key: 'equipmentPointNames',
width: '35%',
className: 'uant-table-thead'
className: 'uant-table-thead',
render: (text, record) => {
//根据换行符分隔
let arr = text.split('\n');
let p = document.createElement('span');
if (arr && arr != null){
arr.map( e => {
if (e.endsWith('##0')){
let grandChildItem = document.createElement('p');
let a = e.replace('##0','');
grandChildItem.innerText = a;
let font = document.createElement('font');
font.innerText = ' 正常';
font.style.color = 'green';
grandChildItem.append(font);
p.append(grandChildItem);
} else {
let grandChildItem = document.createElement('p');
let b = e.replace('##1','');
grandChildItem.innerText = b;
let font = document.createElement('font');
font.innerText = ' 报警';
font.style.color = 'red';
grandChildItem.append(font);
p.append(grandChildItem);
}
});
return <div dangerouslySetInnerHTML={{ __html: p.outerHTML }} />;
}
}
}
];
};
......@@ -58,17 +89,18 @@ class AssociatedEquipTable extends Component {
onRowClick = record => {
let { selectedRowKeys, selectedRows } = this.state;
let exist = false;
let id = record.importantEquipId + '-' + record.equipmentId;
selectedRows.find(item => {
if (item.equipmentId === record.equipmentId) {
if (item.id === id) {
exist = true;
}
});
if (exist) {
selectedRows.splice(selectedRows.findIndex(item => item.equipmentId === record.equipmentId), 1);
selectedRowKeys.splice(selectedRowKeys.findIndex(item => item === record.equipmentId), 1);
selectedRows.splice(selectedRows.findIndex(item => item.id === id), 1);
selectedRowKeys.splice(selectedRowKeys.findIndex(item => item === id), 1);
} else {
selectedRows.push(record);
selectedRowKeys.push(record.equipmentId);
selectedRowKeys.push(id);
}
this.setState({
selectedRows,
......@@ -97,7 +129,8 @@ class AssociatedEquipTable extends Component {
getRowClassName = (record, index) => {
let { selectedRowKeys } = this.state;
if (selectedRowKeys.findIndex(item => item === record.equipmentId) >= 0) {
let id = record.importantEquipId + '-' + record.equipmentId;
if (selectedRowKeys.findIndex(item => item === id) >= 0) {
return 'highlight-row';
} else {
return 'normal-row';
......@@ -132,7 +165,7 @@ class AssociatedEquipTable extends Component {
render() {
let { pagination, isChecked, selectedRowKeys } = this.state;
let { dataList, fetchData, totalCount } = this.props;
dataList.map(data => data.id = data.equipmentId);
dataList.map(data => data.id = data.importantEquipId + '-' + data.equipmentId );
let defaultPageConfig = this.pageConfig;
return (
<div className="risk-model-table">
......
......@@ -46,37 +46,34 @@ const getColumns = () => {
width: '40%',
className: 'uant-table-thead',
render: (text, record) => {
//根据换行符分隔
let arr = text.split("\n");
let p = document.createElement('span')
if(arr && arr!= null){
let arr = text.split('\n');
let p = document.createElement('span');
if (arr && arr != null){
arr.map( e =>{
if(e.endsWith("##0")){
if (e.endsWith('##0')){
let grandChildItem = document.createElement('p');
let a = e.replace("##0","");
grandChildItem.innerText=a;
let a = e.replace('##0','');
grandChildItem.innerText = a;
let font = document.createElement('font');
font.innerText=" 合格";
font.style.color="green";
font.innerText = ' 合格';
font.style.color = 'green';
grandChildItem.append(font);
p.append(grandChildItem)
}else{
p.append(grandChildItem);
} else {
let grandChildItem = document.createElement('p');
let b = e.replace("##1","");
grandChildItem.innerText=b;
let b = e.replace('##1','');
grandChildItem.innerText = b;
let font = document.createElement('font');
font.innerText=" 不合格";
font.style.color="red";
font.innerText = ' 不合格';
font.style.color = 'red';
grandChildItem.append(font);
p.append(grandChildItem)
p.append(grandChildItem);
}
})
return <div dangerouslySetInnerHTML = {{__html:p.outerHTML}} ></div>
});
return <div dangerouslySetInnerHTML={{ __html: p.outerHTML }} />;
}
}
}
......
......@@ -400,11 +400,11 @@ class RiskModel extends Component {
fmeaId && this.bindPoints(fmeaId, pointId, selectData);
}
bindEquipIndexCallback = (equipmentId) => {
bindEquipIndexCallback = (importantEquipId, equipmentId) => {
const { fmeaId } = this.state;
let { selectData } = this.model.state;
selectData = selectData.filter(data => data.equipmentId === equipmentId);
fmeaId && this.bindEquipIndexs(fmeaId , equipmentId, selectData);
fmeaId && this.bindEquipIndexs(fmeaId, importantEquipId, equipmentId, selectData);
}
riskSourceEdit = (body) =>{
......@@ -440,14 +440,15 @@ class RiskModel extends Component {
);
};
bindEquipIndexs = (fmeaId, equipmentId, equipIndexs) => {
bindEquipIndexs = (fmeaId, importEquipId, equipmentId, equipIndexs) => {
let equipmentPointIds = [];
let param = {};
equipIndexs.map(item => {
equipmentPointIds.push(item.equipIndexId);
});
param.equipmentId = equipmentId;
param.fmeaId = fmeaId;
param.importantEquipmentId = importEquipId;
param.equipmentId = equipmentId;
param.equipmentPointIds = equipmentPointIds;
bindEquipIndexAction(param).then(
data => {
......@@ -618,11 +619,12 @@ class RiskModel extends Component {
}
} else if (modelFlag === 'equip'){
if (toolBarFlag){
let { equipData } = this.state;
if (toolBarFlag === '1'){//新增
return <EquipModel bindEquipIndexCallback={this.bindEquipIndexCallback} fmeaId={fmeaId} riskSourceId={riskSourceId} ref={component => this.model = component} /> ;
return <EquipModel bindingEquips={equipData} bindEquipIndexCallback={this.bindEquipIndexCallback} fmeaId={fmeaId} riskSourceId={riskSourceId} ref={component => this.model = component} /> ;
} else if (this.equipRef) {
const { selectedRows } = this.equipRef.state;
return <EquipModel {...selectedRows[0]} bindEquipIndexCallback={this.bindEquipIndexCallback} fmeaId={fmeaId} riskSourceId={riskSourceId} ref={component =>this.model = component} /> ;
return <EquipModel bindingEquips={equipData} {...selectedRows[0]} bindEquipIndexCallback={this.bindEquipIndexCallback} fmeaId={fmeaId} riskSourceId={riskSourceId} ref={component =>this.model = component} /> ;
}
}
}
......
......@@ -28,8 +28,8 @@ class EquipModel extends Component {
}
componentWillMount = () => {
let { eId } = { ...this.props };
eId && this.setState({ eId });
let { importantEquipId } = { ...this.props };
importantEquipId && this.setState({ importantEquipId });
};
setParamAndSearch =(param)=>{
......@@ -60,10 +60,30 @@ class EquipModel extends Component {
}
queryBindEquip = (riskSourceId, equipmentId, fname) => {
let { bindingEquips, importantEquipId } = this.props;
let bindingEquipIds = [];
bindingEquips.map(b => {
if (b.importantEquipId === equipmentId) {
bindingEquipIds.push(b.equipmentId);
}
});
this.setState({ importEquipId: equipmentId });
equipmentId && bindEquipListAction(riskSourceId, equipmentId,0,-1,fname).then(data=>{//查询巡检点项
let { selectData } = this.state;
let content = data.content;//内容
//过滤已经添加的配套设备
content = content.filter(equip => {
console.log(equip);
if (importantEquipId) {
if (bindingEquipIds.includes(equip.id)) {
return true;
}
} else {
if (!bindingEquipIds.includes(equip.id)) {
return true;
}
}
});
if (!fname){
let fireEquip = content.filter(item => item.isBound === 'bound');//已经选择的行数据
let selects = fireEquip.map(e=>{//已经选择的id集合
......@@ -86,7 +106,8 @@ class EquipModel extends Component {
}
queryBindEquipIndex = (fmeaId, equipmentId, equipmentPointName) => {
fmeaId && equipmentId && getBindEquipIndexAction(fmeaId, equipmentId, equipmentPointName).then(data => {
let { importEquipId } = this.state;
fmeaId && equipmentId && getBindEquipIndexAction(fmeaId, importEquipId, equipmentId, equipmentPointName).then(data => {
console.log(data);
let { selectData } = this.state;
if (!equipmentPointName){
......@@ -120,12 +141,12 @@ class EquipModel extends Component {
render() {
let { riskSourceId, bindEquipIndexCallback, fmeaId } = this.props;
let { dataList, importEquipId, equipmentId, selects, eId, indexDataList } = this.state;
let { dataList, importEquipId, equipmentId, selects, importantEquipId, indexDataList } = this.state;
return (
<div className="equip-model">
<EquipTable riskSourceId={riskSourceId} importEquipId={eId} fetchData={this.queryBindEquip} clearCallback={this.clearCallback} />
<EquipTable riskSourceId={riskSourceId} importEquipId={importantEquipId} fetchData={this.queryBindEquip} clearCallback={this.clearCallback} />
<FireEquipTable fmeaId={fmeaId} importEquipId={importEquipId} selects={selects} dataList={dataList} setParamAndSearch={this.setParamAndSearch} fetchData={this.queryBindEquipIndex} clearCallback={this.clearCallback} />
<FireEquipIndexTable bindEquipIndexCallback={bindEquipIndexCallback} fmeaId={fmeaId} equipmentId={equipmentId} selects={selects} dataList={indexDataList} callBack={this.setSelectData} setParamAndSearch={this.setParamAndSearch} />
<FireEquipIndexTable bindEquipIndexCallback={bindEquipIndexCallback} fmeaId={fmeaId} importantEquipId={importEquipId} equipmentId={equipmentId} selects={selects} dataList={indexDataList} callBack={this.setSelectData} setParamAndSearch={this.setParamAndSearch} />
</div>
);
}
......@@ -134,6 +155,8 @@ class EquipModel extends Component {
EquipModel.propTypes = {
bindEquipIndexCallback: PropTypes.func,
riskSourceId: PropTypes.any,
fmeaId: PropTypes.number
fmeaId: PropTypes.number,
bindingEquips: PropTypes.array,
importantEquipId: PropTypes.number
};
export default EquipModel;
......@@ -124,8 +124,8 @@ class FireEquipIndexTable extends Component {
}
save = () => {
const { equipmentId } = this.props;
this.props.bindEquipIndexCallback(equipmentId);
const { importantEquipId, equipmentId } = this.props;
this.props.bindEquipIndexCallback(importantEquipId, equipmentId);
}
render() {
......@@ -165,6 +165,7 @@ FireEquipIndexTable.propTypes = {
setParamAndSearch: PropTypes.func,
callBack: PropTypes.func,
dataList: PropTypes.array,
selects: PropTypes.array
selects: PropTypes.array,
importantEquipId: PropTypes.number
};
export default FireEquipIndexTable;
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