Commit 340a4d6d authored by xinglei's avatar xinglei

修改bug

parent 0267a1ae
......@@ -93,7 +93,12 @@ class FireTruckDetailInfo extends Component {
};
goBack() {
browserHistory.goBack();
let path = {
pathname: '/biz/fireresource',
state: { activeKey: '1' }
};
browserHistory.push(path);
//browserHistory.goBack();
}
fireTruckTableColumns = () => {
......
......@@ -114,24 +114,24 @@ class FireStationMatches extends Component {
pageNumber: 0,
pageSize: 10
},
this.state = {
key: 1,
pagination: true,
selectedRows: [],
selectedRowKeys: [],
dataList: [], //表格数据集合
size: 'small', //表格大小
searchParam: [],
totals: 0, //所有数据总和
requestParam: [],
fireStationId: 0,
equipmentName: '设备名称', //设备名称
equipmentCode: '设备编号', //设备编号
pictureMap: new Map(), //设备相关图片
enableCarousel: false, //是否打开轮播图页面
enableAddOp: false, //是否打开绑定装备页面
type: '',
};
this.state = {
key: 1,
pagination: true,
selectedRows: [],
selectedRowKeys: [],
dataList: [], //表格数据集合
size: 'small', //表格大小
searchParam: [],
totals: 0, //所有数据总和
requestParam: [],
fireStationId: 0,
equipmentName: '设备名称', //设备名称
equipmentCode: '设备编号', //设备编号
pictureMap: new Map(), //设备相关图片
enableCarousel: false, //是否打开轮播图页面
enableAddOp: false, //是否打开绑定装备页面
type: '',
};
}
componentWillMount() {
......@@ -166,14 +166,14 @@ class FireStationMatches extends Component {
param.pageNumber = param.current;
}
Object.assign(searchParam, { ...param });
if(type === 'fireStation'){
if (type === 'fireStation') {
getMatchesFireEquipmentListAction(searchParam, fireStationId, searchParam.pageNumber, searchParam.pageSize).then(data => {
this.setState({
dataList: data.content,
totalCount: data.totalElements
});
});
}else if(type === 'waterResource'){
} else if (type === 'waterResource') {
getMatchesWaterResourceBindEquipListAction(searchParam, fireStationId, searchParam.pageNumber, searchParam.pageSize).then(data => {
this.setState({
dataList: data.content,
......@@ -244,11 +244,11 @@ class FireStationMatches extends Component {
let deleteObj = [];
for (let i = 0; i < selectedRowKeys.length; i++) {
let obj = {};
type==='fireStation'?obj.fireStationId = fireStationId:obj.waterResourceId = fireStationId;
type === 'fireStation' ? obj.fireStationId = fireStationId : obj.waterResourceId = fireStationId;
obj.fireEquipmentId = selectedRowKeys[i];
deleteObj.push(obj);
}
if(type==='fireStation'){
if (type === 'fireStation') {
deleteFireStationMatchesAction(deleteObj).then(
data => {
AmosAlert.success('提示', '删除成功');
......@@ -258,7 +258,7 @@ class FireStationMatches extends Component {
AmosAlert.error('错误', err);
}
);
}else if(type === 'waterResource'){
} else if (type === 'waterResource') {
deleteWaterResourceBindEquipMatchesAction(deleteObj).then(
data => {
AmosAlert.success('提示', '删除成功');
......@@ -303,20 +303,21 @@ class FireStationMatches extends Component {
for (let i = 0; i < selectedRowKeys.length; i++) {
let obj = {};
type==='fireStation'?obj.fireStationId = fireStationId:obj.waterResourceId = fireStationId;
type === 'fireStation' ? obj.fireStationId = fireStationId : obj.waterResourceId = fireStationId;
obj.fireEquipmentId = selectedRowKeys[i];
obj.number = numberInStation[obj.fireEquipmentId] ? numberInStation[obj.fireEquipmentId] : 1;
obj.unit = unitInStation[obj.fireEquipmentId];
bindObj.push(obj);
}
if (bindObj.length > 0) {
if(type === 'fireStation'){
if (type === 'fireStation') {
bindFireStationMatchesAction(bindObj).then(
data => {
if (data.result === 'SUCCESS'){
AmosAlert.success('提示', '添加装备成功');
} else if (data.result === 'FAILURE'){
console.log(data);
if (data.result === 'FAILURE') {
AmosAlert.error('错误', data.message);
} else {
AmosAlert.success('提示', '添加装备成功');
}
this.state.reload();
},
......@@ -324,7 +325,7 @@ class FireStationMatches extends Component {
AmosAlert.error('错误', err || '添加装备失败');
}
);
}else if(type === 'waterResource'){
} else if (type === 'waterResource') {
waterResourcebindEquipMatchesAction(bindObj).then(
data => {
AmosAlert.success('提示', '添加装备成功');
......@@ -336,15 +337,12 @@ class FireStationMatches extends Component {
);
}
}else{
} else {
AmosAlert.error('错误', '请添加装备!');
// this.setState({
// enableAddOp: false
// });
}
this.setState({
enableAddOp: false
});
}
render() {
......@@ -365,12 +363,12 @@ class FireStationMatches extends Component {
/>
<div className='match-equipment-toolbar'>
<div className='match-equipment-toolbar-goback'>
<Button icon={<BizIcon icon="fanhui" />} transparent onClick={() => this.goBack()} />
<Button icon={<BizIcon icon="fanhui" />} transparent onClick={() => this.goBack()} />
</div>
<div className='match-equipment-toolbar-title'>{equipmentHeaderResult(fireStation)}</div>
<div className='match-equipment-toolbar-oper'>
<Button icon={<BizIcon icon="tianjia" />} transparent onClick={() => this.add()} />
<Button icon={<BizIcon icon="shanchu" />} transparent onClick={() => this.delete()} />
<Button icon={<BizIcon icon="tianjia" />} transparent onClick={() => this.add()} />
<Button icon={<BizIcon icon="shanchu" />} transparent onClick={() => this.delete()} />
</div>
</div>
<div className='match-equipment-content'>
......
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