Commit 340a4d6d authored by xinglei's avatar xinglei

修改bug

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