Commit f3086ef5 authored by 李成龙's avatar 李成龙

代码优化

parent 3dd53237
......@@ -4,7 +4,7 @@
"useTabs": false,
"semi": true,
"singleQuote": true,
"parser": "babylon",
"parser": "babel",
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": false,
......
......@@ -13,6 +13,7 @@
securityBaseURI: 'http://172.16.10.72:10005/',
//基础平台
loginURI: 'http://172.16.10.72/',
//地图服务
picURI: 'http://172.16.3.121:8001/'
},
// websocket 地址
......
{
"result": "SUCCESS",
"dataList": [
{ "id": 0, "name": "≤5km", "value": 5000 },
{ "id": 1, "name": "≤36km", "value": 36000 },
{ "id": 2, "name": "≤60km", "value": 60000 },
{ "id": 3, "name": "≤100km", "value": 100000 }
],
"message": null,
"success": true
}
......@@ -3,14 +3,13 @@ import RootView from '../view/monitor';
import Duty from '../view/monitor/duty';
import Situation from '../view/biz/duty/situation';
import SituationDetail from '../view/biz/duty/situationDetail';
import Regulate from '../view/monitor/regulate';
import Bills from '../view/biz/regulate/bills';
import RootBizView from './../view/biz/index';
import EmptyPage from './../view/common/emptyPage/EmptyPage';
import SafetyTraining from './../view/monitor/safetyManage/index';
import DaliyTraining from './../view/monitor/dailyTrain/index';
import EquipmentMaintain from './../view/monitor/equipmentMaintain/index';
import SafetyInspection from './../view/monitor/safetyInspection/index';
import SafetyManage from './../view/monitor/duty/safetyManage/index';
import DaliyTraining from './../view/monitor/duty/dailyTrain/index';
import EquipmentMaintain from './../view/monitor/duty/equipmentMaintain/index';
import SafetyInspection from './../view/monitor/duty/safetyInspection/index';
import FireMaterial from './../view/strength/fireMaterial/index';
import FireVehicle from './../view/strength/fireVehicle/index';
import StationFireMan from './../view/strength/stationFireMan/index';
......@@ -22,26 +21,28 @@ import EmergencyPlan from './../view/biz/emergency/plan';
const Routes = {
main: RootView,
//日常值守
duty: Duty,
situation: Situation,
situationDetail: SituationDetail,
regulate: Regulate,
bills: Bills,
//应急指挥
emergency: Duty,
disaster: Disaster,
history: History,
plan: EmergencyPlan,
safetyTraining: SafetyTraining,
safetyInspection: SafetyInspection,
dailyTrain: DaliyTraining,
equipmentMaintain: EquipmentMaintain,
safetyInspection: SafetyInspection,
safetyTraining: SafetyManage,
//安全监管
regulate: Duty,
bills: Bills,
fireMaterial: FireMaterial,
fireVehicle: FireVehicle,
stationFireMan: StationFireMan,
stationFireTeam: StationFireTeam,
stationDuty: StationDuty
stationDuty: StationDuty,
//应急指挥
emergency: Duty,
disaster: Disaster,
history: History,
plan: EmergencyPlan
};
export const businessRouts = [
......
import { commonGet } from '../utils/request';
const mockFetch = (jsonUrl) => {
return commonGet(jsonUrl);
};
export const mockService = function() {
return mockFetch('/src/_mock/mock.json');
};
......@@ -10,34 +10,20 @@ import PropTypes from 'prop-types';
class Bills extends Component {
constructor(props) {
super(props);
this.state = {
};
}
componentWillMount() {
this.state = {};
}
componentDidMount() {
componentWillMount() {}
}
componentWillUnmount() {
componentDidMount() {}
}
componentWillUnmount() {}
render() {
return (
<div className="class-bills">
单据管理
</div>
);
return <div className="class-bills">单据管理</div>;
}
}
Bills.propTypes = {
};
Bills.propTypes = {};
export default Bills;
This diff is collapsed.
This diff is collapsed.
......@@ -2,12 +2,10 @@ import React, { Component } from 'react';
import DailyTrainyLeft from './DailyTrainLeft';
import DailyTrainRight from './DailyTrainRight';
/**
* 日常训练模块
*/
export default class DailyTrain extends Component {
constructor(props) {
super(props);
this.state = {
......@@ -15,27 +13,25 @@ export default class DailyTrain extends Component {
};
}
componentDidMount(){
componentDidMount() {
//右侧窗口默认显示第一个数据查询的列表
this.list && this.list.onRequestTable((list) => this.onEditClick(list[0]))
this.list && this.list.onRequestTable(list => this.onEditClick(list[0]));
}
onEditClick = (record) => {
this.listTwo.onEdit(record.key)
}
onEditClick = record => {
this.listTwo.onEdit(record.key);
};
render() {
return (
<div className="dailyTrain-safety">
<div className="dailyTrain-safty-content">
<div className="dailyTrain-top"></div>
<div className="dailyTrain-bottom">
<DailyTrainyLeft ref={node => this.list = node} onEditClick={this.onEditClick}/>
<DailyTrainRight ref={node => this.listTwo = node}/>
</div>
</div>
<div className="dailyTrain-safty-content">
<div className="dailyTrain-top" />
<div className="dailyTrain-bottom">
<DailyTrainyLeft ref={node => (this.list = node)} onEditClick={this.onEditClick} />
<DailyTrainRight ref={node => (this.listTwo = node)} />
</div>
</div>
</div>
);
}
......
import React, { Component } from 'react';
import { Input } from 'amos-antd';
import AmosGridTable from './../safetyManage/AmosGridTable';
const Search = Input.Search;
const columns = [
{
title: '序号',
dataIndex: 'key',
width: '10%',
align: 'center', // 设置文本居中的属性
render: val => <span style={{ color: 'white' }}>{val}</span>
},
{
title: '换流站名称',
width: '20%',
dataIndex: 'name',
render: val => <span style={{ color: 'yellow' }}>{val}</span>
},
{
title: '装备类型',
width: '10%',
dataIndex: 'zblx',
render: val => <span style={{ color: 'white' }}>{val}</span>
},
{
title: '累计保养',
width: '10%',
dataIndex: 'ljby',
render: val => <span style={{ color: 'white' }}>{val}</span>
},
{
title: '保养中',
width: '10%',
dataIndex: 'byz',
render: val => <span style={{ color: 'white' }}>{val}</span>
},
{
title: <div className="safe-table-title-font-red">逾期保养</div>,
width: '20%',
dataIndex: 'yqby',
render: val => <span style={{ color: 'red' }}>{val}</span>
},
{
title: <div className="safe-table-title-font-red">逾期占比</div>,
width: '20%',
dataIndex: 'yqzb',
render: val => <span style={{ color: 'red' }}>{val}</span>
}
];
const data = [
{
key: '1',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '2',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '3',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '4',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '5',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '6',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '7',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '8',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '9',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '10',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '11',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '12',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '13',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '14',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '15',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '16',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '17',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '18',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '19',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '20',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '21',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '22',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '23',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '225',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '25',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '26',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '27',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '28',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
},
{
key: '29',
name: '复龙换流站',
zblx: 9,
ljby: 170,
byz: 100,
yqby: 20,
yqzb: '16.7%'
}
];
/**
* 器材保养左侧
*/
class EquipmentMaintainLeft extends Component {
constructor(props) {
super(props);
this.pageConfig = {
current: 1,
pageSize: 14
};
this.state = {
data: [],
loading: false,
equimentId: null,
pagination: true,
isChecked: false,
selectedRows: [],
selectedRowKeys: [],
dataList: [],
newDataList: [],
totalCount: 0,
searchParam: '',
fname: '',
current: 1,
pageSize: 10,
total: 0,
tableHeight: 450
};
}
componentDidMount() {
const { pagination } = this.state;
var box1 = document.getElementById('equipmentMaintain-bottom-left');
var box2 = document.getElementById('one-div');
if (box1 && box2) {
//此处在加一层判断,更加严密,如果box存在的情况下获取
console.log(box1.offsetHeight);
console.log(box2.offsetHeight);
this.setState({
tableHeight: box1.offsetHeight - box2.offsetHeight
});
}
}
onRequestTable = callback => {
this.setState({
data: data,
totalCount: data.length
});
callback && callback(data);
};
onChange = (value, item) => {
console.log(value, item);
};
onTimeChange = (value, dateString) => {
console.log('Selected Time: ', value);
console.log('Formatted Selected Time: ', dateString);
};
onOk = value => {
console.log('onOk: ', value);
};
onChangeSelect = (value, item) => {
console.log(value, item);
};
reload = r => {
this.setState(
{
reload: () => {
r();
this.setState({ selectedRows: [], selectedRowKeys: [] });
}
},
r()
);
};
getAcitonData = () => {
this.setState({
data: data
});
};
/**
* 分页设置参数
*/
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 { riskSourceId, equipmentId, callBack } = this.props;
// callBack(selectedRowKeys,riskSourceId,equipmentId);
};
searchData = () => {
let name = this.state.fname;
alert(name);
};
onChange = (e, value) => {
this.setState({ fname: value });
};
getPanelHeight = () => {
//计算表格高度
var box1 = document.getElementById('equipmentMaintain-bottom-left');
if (box1) {
//此处在加一层判断,更加严密,如果box存在的情况下获取
return box1.offsetHeight * 0.91;
}
};
SearchChange = value => {
alert(value);
};
rowClassName = (record, index) => {
let className = index % 2 ? 'back-01' : 'back-02';
return className;
};
render() {
let defaultPageConfig = this.pageConfig;
const { current, pageSize, total } = this.state;
const { onEditClick } = this.props;
let { pagination, isChecked, fname, data, totalCount, selectedRowKeys } = this.state;
return (
<div className="equipmentMaintain-bottom-left" id="equipmentMaintain-bottom-left">
<div className="equipmentMaintain-bottom-left-content">
<div className="one-div" id="one-div">
<div className="search-one">
{/* <div className="search-one-button" onClick={this.searchData} /> */}
<div className="search-one-input">
<Search placeholder="搜索" onSearch={this.SearchChange} />
</div>
</div>
</div>
<div className="two-div">
<AmosGridTable
columns={columns}
dataList={data}
isPageable={pagination}
totals={totalCount}
callBack={this.reload}
selectedRowKeys={selectedRowKeys}
getSelectedRows={this.getSelectedRows}
getTableDataAction={this.getAcitonData}
isChecked={isChecked}
setPageConfig={this.setPageConfig}
defaultPageConfig={defaultPageConfig}
getPanelHeight={this.getPanelHeight}
rowClassName={this.rowClassName}
onRowClick={record => onEditClick(record)}
/>
</div>
</div>
</div>
);
}
}
EquipmentMaintainLeft.propTypes = {};
export default EquipmentMaintainLeft;
......@@ -2,12 +2,10 @@ import React, { Component } from 'react';
import EquipmentMaintainLeft from './EquipmentMaintainLeft';
import EquipmentMaintainRight from './EquipmentMaintainRight';
/**
* 器材保养模块
*/
export default class EquipmentMaintainTrain extends Component {
constructor(props) {
super(props);
this.state = {
......@@ -15,27 +13,25 @@ export default class EquipmentMaintainTrain extends Component {
};
}
componentDidMount(){
componentDidMount() {
//右侧窗口默认显示第一个数据查询的列表
this.list && this.list.onRequestTable((list) => this.onEditClick(list[0]))
this.list && this.list.onRequestTable(list => this.onEditClick(list[0]));
}
onEditClick = (record) => {
this.listTwo.onEdit(record.key)
}
onEditClick = record => {
this.listTwo.onEdit(record.key);
};
render() {
return (
<div className="equipmentMaintain-safety">
<div className="equipmentMaintain-safty-content">
<div className="equipmentMaintain-top"></div>
<div className="equipmentMaintain-bottom">
<EquipmentMaintainLeft ref={node => this.list = node} onEditClick={this.onEditClick}/>
<EquipmentMaintainRight ref={node => this.listTwo = node}/>
</div>
</div>
<div className="equipmentMaintain-safty-content">
<div className="equipmentMaintain-top"></div>
<div className="equipmentMaintain-bottom">
<EquipmentMaintainLeft ref={node => (this.list = node)} onEditClick={this.onEditClick} />
<EquipmentMaintainRight ref={node => (this.listTwo = node)} />
</div>
</div>
</div>
);
}
......
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import loadScripts from 'dt2react/lib/utils/loadScripts';
import { outMap } from './../../../consts/urlConsts';
import CenterLevelLeft from './../../monitor/statistical/indexLeft';
import CenterLevelRight from './../../monitor/statistical/indexRight';
/**
* duty
......@@ -11,32 +14,63 @@ class Duty extends Component {
constructor(props) {
super(props);
this.state = {
loadAmap: false,
BasicMap: null,
flag: false
};
}
componentWillMount() {
componentWillMount() {}
componentDidMount() {
this.initMap();
}
componentDidMount() {
componentWillUnmount() {}
}
initMap() {
if (outMap) {
let script = null;
let mainUI = null;
componentWillUnmount() {
script = {
key: 'amapscripts',
url: `/extra/amap/js/outamap.1.4.6.js?rnd= ${Math.random()}`
};
mainUI = {
key: 'mainUI',
url: '/extra/amap/js/outmain.1.4.6.js'
};
loadScripts.asyncLoadScript(script, () => {
loadScripts.asyncLoadScript(mainUI, () => {
setTimeout(() => {
this.setState({
loadAmap: true,
BasicMap: require('./mapScreen/BasicMap')
});
}, 2000);
});
});
} else {
this.setState({
loadAmap: true,
BasicMap: require('./mapScreen/BasicMap')
});
}
}
render() {
let BasicMap = this.state.BasicMap;
return (
<div className="duty-root">
{this.state.loadAmap && <BasicMap />}
<CenterLevelLeft />
<CenterLevelRight />
</div>
);
}
}
Duty.propTypes = {
};
Duty.propTypes = {};
export default Duty;
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { BaseMap, Marker, Polyline, Circle } from 'amos-amap';
import { _picURI, _mapCenter } from './../../../consts/urlConsts';
import imgStatic from './../../../consts/imgStatic';
import mapData from './../../../_mock/mapData';
import { BaseMap, Marker, Polyline } from 'amos-amap';
import { _picURI, _mapCenter,outMap } from './../../../../consts/urlConsts';
import imgStatic from './../../../../consts/imgStatic';
import mapData from './../../../../_mock/mapData';
import { getIcon } from './conf';
import { up } from './conf';
import { utils } from 'amos-tool';
import { outMap } from './../../../consts/urlConsts';
const mapIcon = imgStatic.mapIcon;
const showZoom = 5;
......@@ -16,7 +13,6 @@ const mapConfig = {
zoom: showZoom,
resizeEnable: true,
zoomEnable: true,
// plugins: ['Scale', 'MapType', 'OverView', 'ControlBar'],
plugins: ['Scale'],
zooms: [showZoom, showZoom],
expandZoomRange: true,
......@@ -36,7 +32,6 @@ const layers = [
const statusEnum = { '2': '告警', '3': '高风险' };
/**
* 地图首页
*
......@@ -55,14 +50,14 @@ class BasicMap extends Component {
};
}
componentDidMount(){
componentDidMount() {
this.initData();
}
initData = () => {
let temp = [];
mapData.map(item => {
if (item.status !== 1){
if (item.status !== 1) {
temp.push(item);
}
});
......@@ -70,23 +65,23 @@ class BasicMap extends Component {
this.setState({
alarmList: temp
});
}
};
initMap = () => {
window.map.on('click', function(e) {
document.getElementById("lnglat").value = e.lnglat.getLng() + ',' + e.lnglat.getLat()
document.getElementById('lnglat').value = e.lnglat.getLng() + ',' + e.lnglat.getLat();
});
};
onClick = (e) =>{
onClick = e => {
let visibleList = e.aliasName;
let num = 0;
let temp = {};
mapData.map(item => {
if (visibleList.includes(item.name)){
if (visibleList.includes(item.name)) {
num = num + 1;
item.title = true;
if (num === 1 ){
if (num === 1) {
temp = item;
}
} else {
......@@ -97,39 +92,39 @@ class BasicMap extends Component {
visible: true,
selectData: temp
});
setTimeout(()=>{
setTimeout(() => {
this.setState({
visible: false
});
},500);
}
}, 500);
};
renderAliasLine = (e) => {
renderAliasLine = e => {
let { selectData } = this.state;
let divStyle = {
marginTop: '-11px',
transform: `rotate(${selectData.gradient}deg)`
};
if (selectData.gradient <= 0){
if (selectData.gradient <= 0) {
divStyle.marginTop = '-50px';
}
if (selectData.position === 'right'){
if (selectData.position === 'right') {
divStyle.right = '0px';
}
if (selectData.pathName){
if (selectData.pathName) {
return (
<Marker key={selectData.id} zIndex={1} position={{ longitude: selectData.lng, latitude: selectData.lat }}>
<div className={`content-alias`} style={divStyle}>
<img src={mapIcon.alias_line} style={{ width: `${selectData.width}px`, height: `${selectData.height}px` }}></img>
<img src={mapIcon.alias_title} className='alias-title'></img>
<img src={mapIcon.alias_line} style={{ width: `${selectData.width}px`, height: `${selectData.height}px` }} />
<img src={mapIcon.alias_title} className="alias-title" />
<span style={{ width: `${selectData.width}px` }}>{selectData.pathName}</span>
</div>
</Marker>
);
}
}
};
/**
* 设置末端marker
......@@ -137,28 +132,33 @@ class BasicMap extends Component {
* @memberof BasicMap
*/
setBodyMarker = () => {
let { aliasName } = this.state;
return (mapData || []).map((item, index) => {
if (item.type === 'center') {
return (<Marker key={item.id} zIndex={1} position={{ longitude: item.lng, latitude: item.lat }}>
<div className={`marker-center`}>
<div className='title'>
<span>{item.name}</span>
<img src={mapIcon.endmost_title_2} />
return (
<Marker key={item.id} zIndex={1} position={{ longitude: item.lng, latitude: item.lat }}>
<div className={`marker-center`}>
<div className="title">
<span>{item.name}</span>
<img src={mapIcon.endmost_title_2} />
</div>
<img src={getIcon(item.type, item.status)}></img>
</div>
<img src={getIcon(item.type, item.status)}></img>
</div>
</Marker>);
</Marker>
);
} else {
return (<Marker key={item.id} zIndex={1} position={{ longitude: item.lng, latitude: item.lat }}>
<div className={`marker-icon`}>
{ item.title && <div className='title'>
<span>{item.name}</span>
<img src={getIcon(item.type, 'title_' + item.status)} />
</div>}
<img src={getIcon(item.type, item.status)} onClick={() => this.onClick(item)}></img>
</div>
</Marker>);
return (
<Marker key={item.id} zIndex={1} position={{ longitude: item.lng, latitude: item.lat }}>
<div className={`marker-icon`}>
{item.title && (
<div className="title">
<span>{item.name}</span>
<img src={getIcon(item.type, 'title_' + item.status)} />
</div>
)}
<img src={getIcon(item.type, item.status)} onClick={() => this.onClick(item)}></img>
</div>
</Marker>
);
}
});
};
......@@ -172,13 +172,7 @@ class BasicMap extends Component {
let { lineStyle } = this.state;
return (mapData || []).map((item, index) => {
if (item) {
return ( <Polyline
key={item.id}
zIndex={11}
path={item.path}
style={lineStyle}
extData={item}
/>);
return <Polyline key={item.id} zIndex={11} path={item.path} style={lineStyle} extData={item} />;
}
});
};
......@@ -187,37 +181,38 @@ class BasicMap extends Component {
let { alarmList } = this.state;
return (alarmList || []).map((item, index) => {
if (item) {
return (<div className={`row-${item.status}`} key={index}>
<span>{item.name}</span>
<span className='right'>{statusEnum[item.status]}</span>
</div>);
return (
<div className={`row-${item.status}`} key={index}>
<span>{item.name}</span>
<span className="right">{statusEnum[item.status]}</span>
</div>
);
}
});
}
};
buildExplain = () => {
return (
<div className='content-explain'>
<div className='row'>
<div className='fault'></div>
<div className="content-explain">
<div className="row">
<div className="fault"></div>
<span>高风险</span>
</div>
<div className='row'>
<div className='alarm'></div>
<div className="row">
<div className="alarm"></div>
<span>告警</span>
</div>
<div className='row'>
<div className='normal'></div>
<div className="row">
<div className="normal"></div>
<span>安全</span>
</div>
</div>
);
}
};
setInstanceToGlobal = inst => {
this.map = inst;
window.map = inst;
//this.initMap();
};
render() {
......@@ -231,20 +226,15 @@ class BasicMap extends Component {
let { mapCenter, visible } = this.state;
return (
<div className="map-root">
<div className='content-alarm'>
{this.buildAlarm()}
</div>
{visible && <div className='loading'>
<img src={mapIcon.loading}></img>
<span>数据更新完毕!</span>
</div>}
<div className='map'>
<BaseMap events={events}
useAMapUI
center={mapCenter}
{...mapConfig}
dragEnable={false}
>
<div className="content-alarm">{this.buildAlarm()}</div>
{visible && (
<div className="loading">
<img src={mapIcon.loading}></img>
<span>数据更新完毕!</span>
</div>
)}
<div className="map">
<BaseMap events={events} useAMapUI center={mapCenter} {...mapConfig} dragEnable={false}>
{this.setBodyMarker()}
{this.setBodyLine()}
{this.renderAliasLine()}
......@@ -261,7 +251,6 @@ class BasicMap extends Component {
}
}
BasicMap.propTypes = {
};
BasicMap.propTypes = {};
export default BasicMap;
import imgStatic from './../../../consts/imgStatic';
const mapIcon = imgStatic.mapIcon;
import imgStatic from './../../../../consts/imgStatic';
const mapIcon = imgStatic.mapIcon;
export const up = (x,y) => {
return y.status - x.status;
};
export const getIcon = (type, status) => {
return mapIcon[`${type}_${status}`];
};
import React, { Component } from 'react';
import SafetyInspectionLeft from './SafetyInspectionLeft';
/**
* 安全巡检模块
*/
export default class SafetyInspection extends Component {
render() {
return (
<div className="safetyInspection-safety">
<div className="safetyInspection-safty-content">
<div className="safetyInspection-top"></div>
<div className="safetyInspection-bottom">
<SafetyInspectionLeft />
</div>
</div>
<div className="safetyInspection-safty-content">
<div className="safetyInspection-top"></div>
<div className="safetyInspection-bottom">
<SafetyInspectionLeft />
</div>
</div>
</div>
);
}
......
This diff is collapsed.
......@@ -2,7 +2,6 @@ import React, { Component } from 'react';
import SafteyLeft from './SafteyLeft';
import SafteyRight from './SafteyRight';
/**
* 安全培训
*/
......@@ -14,26 +13,25 @@ export default class Safety extends Component {
};
}
componentDidMount(){
componentDidMount() {
//右侧窗口默认显示第一个数据查询的列表
this.list && this.list.onRequestTable((list) => this.onEditClick(list[0]))
this.list && this.list.onRequestTable(list => this.onEditClick(list[0]));
}
onEditClick = (record) => {
this.listTwo.onEdit(record.key)
}
onEditClick = record => {
this.listTwo.onEdit(record.key);
};
render() {
return (
<div className="fire-safety">
<div className="fire-safty-content">
<div className="fire-top"></div>
<div className="fire-bottom">
<SafteyLeft ref={node => this.list = node} onEditClick={this.onEditClick}/>
<SafteyRight ref={node => this.listTwo = node}/>
</div>
</div>
<div className="fire-safty-content">
<div className="fire-top"></div>
<div className="fire-bottom">
<SafteyLeft ref={node => (this.list = node)} onEditClick={this.onEditClick} />
<SafteyRight ref={node => (this.listTwo = node)} />
</div>
</div>
</div>
);
}
......
import React, { Component } from 'react';
import { Tabs } from 'amos-antd';
const { TabPane} = Tabs;
const { TabPane } = Tabs;
/**
* 消防实力统计详情
*/
class FireStrengthDetail extends Component {
constructor(props) {
super(props);
this.state = {
......@@ -17,34 +14,27 @@ class FireStrengthDetail extends Component {
};
}
componentDidMount() {
}
componentDidMount() {}
render() {
return (
<div className="fire-strength-detail">
<Tabs defaultactivekey="1" type="card">
<TabPane tab="Tab 1" key="1">
Content of Tab Pane 1
</TabPane>
<TabPane tab="Tab 2" key="2">
Content of Tab Pane 2
</TabPane>
<TabPane tab="Tab 3" key="3">
Content of Tab Pane 3
</TabPane>
</Tabs>
</div>
<Tabs defaultactivekey="1" type="card">
<TabPane tab="Tab 1" key="1">
Content of Tab Pane 1
</TabPane>
<TabPane tab="Tab 2" key="2">
Content of Tab Pane 2
</TabPane>
<TabPane tab="Tab 3" key="3">
Content of Tab Pane 3
</TabPane>
</Tabs>
</div>
);
}
}
FireStrengthDetail.propTypes = {
};
FireStrengthDetail.propTypes = {};
export default FireStrengthDetail;
......@@ -3,16 +3,6 @@ import PropTypes from 'prop-types';
import { sessionConsts } from '../../consts/storageConsts';
import { Store } from 'amos-tool';
import Header from './../main/header';
import loadScripts from 'dt2react/lib/utils/loadScripts';
import { outMap } from './../../consts/urlConsts';
import { Modal, Select } from 'amos-framework';
import RiskControlTable from './../monitor/statistical/RiskControlTable';
import DangerControlTable from './../monitor/statistical/DangerControlTable';
import AlarmControlTable from './../monitor/statistical/AlarmControlTable';
import CenterLevelLeft from './../monitor/statistical/indexLeft';
import CenterLevelRight from './../monitor/statistical/indexRight';
const lsTool = Store.lsTool;
......@@ -27,13 +17,8 @@ class RootView extends Component {
super(props);
this.state = {
submenu: [],
extendSystem: [],
loadAmap: false,
BasicMap: null,
visible1: false,
visible2: false,
visible3: false,
flag:false,
extendSystem: []
};
}
......@@ -41,114 +26,23 @@ class RootView extends Component {
let systemMenu = [];
let systemMenus = JSON.parse(lsTool.read(sessionConsts.systemMenu));
systemMenus.map(e =>{
if(e.permissionName && e.permissionName !=="消防安全管理" && e.permissionName !=="消防实力情况" ){
systemMenu.push(e)
if (e.permissionName && e.permissionName !== '消防安全管理' && e.permissionName !== '消防实力情况' ){
systemMenu.push(e);
}
})
});
this.setState({ extendSystem: systemMenu });
}
componentDidMount() {
if (outMap) {
Object.keys(localStorage).map(e => {
if (e.indexOf('_AMap') === 0) {
localStorage.removeItem(e);
}
});
let script = null;
let mainUI = null;
script = {
key: 'amapscripts',
//url: `//172.16.3.121:8085/extra/amap/js/outamap.1.4.6.js?rnd= ${Math.random()}`
url: `/extra/amap/js/outamap.1.4.6.js?rnd= ${Math.random()}`
};
mainUI = {
key: 'mainUI',
//url: '//10.56.28.228/webapi.amap.com/ui/1.0/main.js'
url: '/extra/amap/js/outmain.1.4.6.js'
};
loadScripts.asyncLoadScript(script, () => {
loadScripts.asyncLoadScript(mainUI, () => {
setTimeout(() => {
this.setState({
loadAmap: true,
BasicMap: require('./mapScreen/BasicMap')
});
}, 2000);
});
});
} else {
this.setState({
loadAmap: true,
BasicMap: require('./mapScreen/BasicMap')
});
}
}
componentWillUnmount() {
}
cancel = () => {
this.setState({
visible1: false,
visible2: false,
visible3: false,
flag:true,
});
}
getContext = (type) => {
const { flag } = this.state;
if(type==='1'){
return <RiskControlTable refresh={flag}/>;
}else if(type==='2'){
return <DangerControlTable refresh={flag} />;
}else if(type==='3'){
return <AlarmControlTable refresh={flag} />;
}
};
ondetails = (type) => {
if(type==='1'){
this.setState({
visible1: true
});
}else if(type==='2'){
this.setState({
visible2: true
});
}else{
this.setState({
visible3: true
});
}
};
render() {
const { visible1,visible2,visible3,flag } = this.state;
let type1="1";
let type2="2";
let type3="3";
const { children } = this.props;
let BasicMap = this.state.BasicMap;
return (
<div className="view-root">
<div className="header">
......@@ -156,51 +50,7 @@ class RootView extends Component {
</div>
<div className="content-body">
{children}
{ this.state.loadAmap && <BasicMap />}
</div>
<CenterLevelLeft ondetails={ this.ondetails } />
<CenterLevelRight />
<Modal
header="风险管控情况"
visible={visible1}
className="risk-model-model99"
width={'50%'}
noDefaultFooter
content={ this.getContext(type1)}
onCancel={ this.cancel}
destroyOnClose={true}
/>
<Modal
header="隐患管控情况"
visible={visible2}
className="risk-model-model99"
width={'50%'}
noDefaultFooter
content={ this.getContext(type2)}
onCancel={ this.cancel }
destroyOnClose={true}
/>
<Modal
header="告警管控情况"
visible={visible3}
className="risk-model-model99"
width={'50%'}
noDefaultFooter
content={this.getContext(type3)}
onCancel={ this.cancel}
destroyOnClose={true}
/>
</div>
);
}
......
import React, { Component } from 'react';
import PropTypes from 'prop-types';
/**
* MapScreen
* 地图
* @class MapScreen
* @extends {Component}
*/
class MapScreen extends Component {
constructor(props) {
super(props);
this.state = {
};
}
componentWillMount() {
}
componentDidMount() {
}
componentWillUnmount() {
}
render() {
return (
<div className="map-root">
</div>
);
}
}
MapScreen.propTypes = {
};
export default MapScreen;
import React, { Component } from 'react';
import PropTypes from 'prop-types';
/**
* regulate
*安全监管
* @class regulate
* @extends {Component}
*/
class Regulate extends Component {
constructor(props) {
super(props);
this.state = {
};
}
componentWillMount() {
}
componentDidMount() {
}
componentWillUnmount() {
}
render() {
return (
<div className="duty-root">
</div>
);
}
}
Regulate.propTypes = {
};
export default Regulate;
This diff is collapsed.
import React, { Component } from 'react';
import ReactEcharts from 'amos-viz/lib/echarts';
import { Modal } from 'amos-framework';
import AlarmControlTable from './AlarmControlTable';
/**
* 告警管控
*/
export default class AlarmControl extends Component {
constructor(props) {
super(props);
this.state = {
seriesData:[],
hj:0,
gz:0,
xj:0
seriesData: [],
hj: 0,
gz: 0,
xj: 0,
visible: false
};
}
componentDidMount(){
componentDidMount() {
let dates = [
{ value: 3, name: '火警告警' },
{ value: 31, name: '故障告警' },
{ value: 10, name: '巡检告警' }
];
let dates=[
{value:3, name:'火警告警'},
{value:31, name:'故障告警'},
{value:10, name:'巡检告警'},
];
if(dates){
this.setState({ seriesData: dates,hj:dates[0].value,gz:dates[1].value,xj:dates[2].value});
}
if (dates) {
this.setState({ seriesData: dates, hj: dates[0].value, gz: dates[1].value, xj: dates[2].value });
}
}
ondetails = (type) => {
this.props.ondetails("3");
};
//获取告警管控数据
//获取告警管控数据
getOptionsx = () => {
const { seriesData } = this.state;
return {
color:['rgba(243, 12, 12, 1)','rgba(219, 121, 23, 1)','rgba(209, 209, 52, 1)'],
return {
color: ['rgba(243, 12, 12, 1)', 'rgba(219, 121, 23, 1)', 'rgba(209, 209, 52, 1)'],
series: [
{
name: "",
type: "pie",
radius: ["0%", "55%"],
center: ["50%", "50%"],
name: '',
type: 'pie',
radius: ['0%', '55%'],
center: ['50%', '50%'],
label: {
show: false
show: false
},
itemStyle: {
normal: {
color: 'rgba(24,219,159,0.1)'
},
normal: {
color: 'rgba(24,219,159,0.1)'
}
},
hoverAnimation: false,
data: [100]
},
{
name:'检查点',
type:'pie',
radius: ['60%', '72%'],
center: ['50%', '50%'],
avoidLabelOverlap: false,
label: {
normal: {
show: true,
position: 'center',
formatter: function(param) {
let total = 0;
seriesData.forEach(e => {
total += e.value;
})
var view = '{val|' +total + '}\n{name|' + '告警总数' + '}';
return view;
},
textStyle: {
rich: {
name: {
fontSize: 12,
fontFamily:'Microsoft YaHei',
color:'rgba(255,255,255,1)',
},
val: {
fontSize: 20,
fontWeight: 'bold',
fontFamily:'Microsoft YaHei',
color: 'rgba(255,255,255,1)',
}
}
}
},
},
{
name: '检查点',
type: 'pie',
radius: ['60%', '72%'],
center: ['50%', '50%'],
avoidLabelOverlap: false,
label: {
normal: {
show: true,
position: 'center',
formatter: function(param) {
let total = 0;
seriesData.forEach(e => {
total += e.value;
});
var view = '{val|' + total + '}\n{name|' + '告警总数' + '}';
return view;
},
labelLine: {
normal: {
show: false
textStyle: {
rich: {
name: {
fontSize: 12,
fontFamily: 'Microsoft YaHei',
color: 'rgba(255,255,255,1)'
},
val: {
fontSize: 20,
fontWeight: 'bold',
fontFamily: 'Microsoft YaHei',
color: 'rgba(255,255,255,1)'
}
},
data:seriesData
}
}
}
}
},
labelLine: {
normal: {
show: false
}
},
data: seriesData
}
]
};
}
};
open = () => {
this.setState({ visible: true });
};
cancel = () => {
this.setState({ visible: false });
};
render() {
const { hj,gz,xj } = this.state;
const { hj, gz, xj, visible } = this.state;
return (
<div className="AlarmControl">
<div className="AlarmControl_1">
<div className="AlarmControl_1_1"><span>告警管控情况</span></div>
</div>
<div className="AlarmControl_2">
<div className="AlarmControl_2_1" onClick={this.ondetails}> </div>
<div className="AlarmControl_2_2">
<div className="AlarmControl_2_2_1">
<div className="AlarmControl8">
<div className="AlarmControl_1">
<div className="AlarmControl_1_1">
<span>告警管控情况</span>
</div>
</div>
<div className="AlarmControl_2">
<div className="AlarmControl_2_1" onClick={()=>this.open()} />
<Modal
header="告警管控情况"
visible={visible}
className="risk-model-model99"
width={'50%'}
dragable
noDefaultFooter
content={<AlarmControlTable />}
onCancel={this.cancel}
destroyOnClose
/>
<div className="AlarmControl_2_2">
<div className="AlarmControl_2_2_1">
<div className="AlarmControl8">
<div className="AlarmControl2">
<div className="AlarmControl2_1">
<div className="AlarmControl2_12"> 火警告警:</div>
<div className="AlarmControl2_13">{hj}</div>
</div>
<div className="AlarmControl2_2"></div>
</div>
<div className="AlarmControl2">
<div className="AlarmControl2_1">
<div className="AlarmControl2_12">故障告警:</div>
<div className="AlarmControl2_13">{gz}</div>
</div>
<div className="AlarmControl2_3"></div>
</div>
<div className="AlarmControl2">
<div className="AlarmControl2_1" >
<div className="AlarmControl2_12">巡检告警:</div>
<div className="AlarmControl2_13">{xj}</div>
</div>
<div className="AlarmControl2_4"></div>
</div>
</div>
</div>
<div className="AlarmControl_2_2_2">
<ReactEcharts option = { this.getOptionsx() } />
</div>
</div>
</div>
<div className="AlarmControl2_1">
<div className="AlarmControl2_12"> 火警告警:</div>
<div className="AlarmControl2_13">{hj}</div>
</div>
<div className="AlarmControl2_2" />
</div>
<div className="AlarmControl2">
<div className="AlarmControl2_1">
<div className="AlarmControl2_12">故障告警:</div>
<div className="AlarmControl2_13">{gz}</div>
</div>
<div className="AlarmControl2_3" />
</div>
<div className="AlarmControl2">
<div className="AlarmControl2_1">
<div className="AlarmControl2_12">巡检告警:</div>
<div className="AlarmControl2_13">{xj}</div>
</div>
<div className="AlarmControl2_4" />
</div>
</div>
</div>
<div className="AlarmControl_2_2_2">
<ReactEcharts option={this.getOptionsx()} />
</div>
</div>
</div>
</div>
);
}
}
import React, { Component } from 'react';
import ReactEcharts from 'amos-viz/lib/echarts';
import echarts from 'echarts/lib/echarts';
//import { AllSafetyAction } from './../../../services/centerLevelService';
/**
* 总体消防安全情况
*/
const option = {
tooltip: {
trigger: 'item',
formatter: "{a} <br/>{b}: {c} ({d}%)"
formatter: '{a} <br/>{b}: {c} ({d}%)'
},
// color: ['#00CACE', '#F70D0E'],
color: ['#F70D0E', '#00CACE'],
graphic: [{ //环形图中间添加文字
type: 'text', //通过不同top值可以设置上下显示
left: 'center',
top: '30%',
style: {
text: '80', //'80' + '\n' + '总数'
textAlign: 'center',
fill: "rgba(255,255,255,1)", //文字的颜色
width: 30,
height: 30,
fontSize: 25,
fontFamily: "Microsoft YaHei",
fontWeight:"bold"
}
},
{ //环形图中间添加文字
type: 'text', //通过不同top值可以设置上下显示
left: 'center',
top: '45%',
style: {
text: '站点',
textAlign: 'center',
fill: "rgba(255,255,255,1)", //文字的颜色
width: 24,
height: 16,
fontSize: 12,
fontFamily: "Microsoft YaHei",
fontWeight:400
graphic: [
{
//环形图中间添加文字
type: 'text', //通过不同top值可以设置上下显示
left: 'center',
top: '30%',
style: {
text: '80', //'80' + '\n' + '总数'
textAlign: 'center',
fill: 'rgba(255,255,255,1)', //文字的颜色
width: 30,
height: 30,
fontSize: 25,
fontFamily: 'Microsoft YaHei',
fontWeight: 'bold'
}
},
{
//环形图中间添加文字
type: 'text', //通过不同top值可以设置上下显示
left: 'center',
top: '45%',
style: {
text: '站点',
textAlign: 'center',
fill: 'rgba(255,255,255,1)', //文字的颜色
width: 24,
height: 16,
fontSize: 12,
fontFamily: 'Microsoft YaHei',
fontWeight: 400
}
}
}],
],
series: [
series: [
{
name: '总体消防安全情况',
type: 'pie',
......@@ -67,30 +62,26 @@ const option = {
data: [
{
value: 40,
name: "不合格",
name: '不合格'
},
{
value: 60,
name: '正常',
name: '正常'
}
]
},
{
name: "中间的背景",
type: "pie",
radius: ["0%", "60%"],
center: ["50%", "40%"],
name: '中间的背景',
type: 'pie',
radius: ['0%', '60%'],
center: ['50%', '40%'],
label: {
show: false
show: false
},
itemStyle: {
normal: {
color: 'rgba(24,219,159,0.1)'
},
normal: {
color: 'rgba(24,219,159,0.1)'
}
},
//隐藏多余文字提示
label: {
......@@ -102,16 +93,14 @@ const option = {
tooltip: {
show: false
},
// hoverAnimation: false,
data: [100]
}
}
]
};
class AllSafety extends Component {
constructor(props) {
super(props);
this.state = {
......@@ -119,25 +108,15 @@ class AllSafety extends Component {
};
}
componentDidMount() {
}
componentDidMount() {}
getOptionsx = () => {
return option;
}
};
render() {
return (
<div className="AllSafety">
<div className="all-safety-content">
<div className="all-safety-font">总体消防安全情况</div>
<div className="content-detail">
......@@ -145,35 +124,31 @@ class AllSafety extends Component {
<ReactEcharts option={this.getOptionsx()} className="div-echars" />
</div>
<div className="all-safety-right">
<div className="all-safety-right-one">
<div className="right-one-font">1</div>
</div>
<div className="all-safety-right-two">
<div className="right-two-font"><span className="jiantou">&darr;</span>-1</div>
</div>
<div className="all-safety-right-three">
<div className="right-three-font">1</div>
</div>
<div className="all-safety-right-four">
<div className="right-four-font"><span className="jiantou">&uarr;</span>+1</div>
</div>
<div className="all-safety-right-one">
<div className="right-one-font">1</div>
</div>
<div className="all-safety-right-two">
<div className="right-two-font">
<span className="jiantou">&darr;</span>-1
</div>
</div>
<div className="all-safety-right-three">
<div className="right-three-font">1</div>
</div>
<div className="all-safety-right-four">
<div className="right-four-font">
<span className="jiantou">&uarr;</span>+1
</div>
</div>
</div>
</div>
</div>
{/* <ReactEcharts option={this.getOptionsx(map)} className='echart-week' /> */}
</div>
);
}
}
AllSafety.propTypes = {
};
AllSafety.propTypes = {};
export default AllSafety;
import React, { Component } from 'react';
import { Store } from 'amos-tool';
import { sessionConsts } from './../../../consts/storageConsts';
import { browerSupport, consts, Store, LocationParam } from 'amos-tool';
const lsTool = Store.lsTool;
const lsTool = Store.lsTool;
/**
* 消防安全管理
*/
class FireSafety extends Component {
constructor(props) {
super(props);
this.state = {
......@@ -20,107 +14,77 @@ class FireSafety extends Component {
};
}
componentDidMount() {
componentDidMount() {}
}
onClick = () =>{
let sbm = null
onClick = () => {
let sbm = null;
let systemMenu = JSON.parse(lsTool.read(sessionConsts.systemMenu)) || [];
systemMenu.map(e =>{
if(e.permissionName && e.permissionName==="消防安全管理" ){
systemMenu.map(e => {
if (e.permissionName && e.permissionName === '消防安全管理') {
sbm = e;
}
})
if(sbm!==null){
window.localStorage.setItem('submenu',JSON.stringify(sbm.children));
});
if (sbm !== null) {
window.localStorage.setItem('submenu', JSON.stringify(sbm.children));
}
}
// handleData = (data) => {
// let map = new Map();
// if (data && data.length > 0) {
// data.map(item => {
// map.set(item.name, item.value);
// })
// }
// return map;
// }
};
render() {
return (
<div className="FireSafety">
<div className="fire-safety-content">
<div className="fire-safety-font">消防安全管理(累计)</div>
<div className="fire-safety-tongji" >
<div className="fire-safety-tongji">
<div className="content-tongji" onClick={this.onClick}>
<div className="left-div">
<span className='titleIcon-yjya'></span>
<span className="titleIcon-yjya"></span>
</div>
<span className='fire-safety-wenzi'>应急预案</span>
<span className="fire-safety-wenzi">应急预案</span>
<span className="right-font">100</span>
</div>
</div>
<div className="fire-safety-tongji">
<div className="content-tongji" onClick={this.onClick}>
<div className="content-tongji" onClick={this.onClick}>
<div className="left-div">
<span className='titleIcon-aqpx' ></span>
<span className="titleIcon-aqpx"></span>
</div>
<span className='fire-safety-wenzi'>安全培训</span>
<span className="fire-safety-wenzi">安全培训</span>
<span className="right-font">123</span>
</div>
</div>
<div className="fire-safety-tongji">
<div className="content-tongji" onClick={this.onClick}>
<div className="left-div">
<span className='titleIcon-rcxl' ></span>
<span className="titleIcon-rcxl"></span>
</div>
<span className='fire-safety-wenzi'>日常训练</span>
<span className="fire-safety-wenzi">日常训练</span>
<span className="right-font">100</span>
</div>
</div>
<div className="fire-safety-tongji">
<div className="content-tongji" onClick={this.onClick}>
<div className="left-div">
<span className='titleIcon-qcby'></span>
<span className="titleIcon-qcby"></span>
</div>
<span className='fire-safety-wenzi'>器材保养</span>
<span className="fire-safety-wenzi">器材保养</span>
<span className="right-font">14445</span>
</div>
</div>
<div className="fire-safety-tongji">
<div className="content-tongji">
<div className="left-div">
<span className='titleIcon-aqxj' ></span>
<span className="titleIcon-aqxj"></span>
</div>
<span className='fire-safety-wenzi'>安全巡检</span>
<span className="fire-safety-wenzi">安全巡检</span>
<span className="right-font">800</span>
</div>
</div>
{/**分割线 */}
</div>
</div>
);
}
}
FireSafety.propTypes = {
};
FireSafety.propTypes = {};
export default FireSafety;
import React, { Component } from 'react';
import { Modal } from 'amos-framework';
import FireStrengthDetail from'./../firestrength/FireStrengthDetail';
import { Store } from 'amos-tool';
import FireStrengthDetail from './../firestrength/FireStrengthDetail';
import { sessionConsts } from './../../../consts/storageConsts';
import {Store, } from 'amos-tool';
const lsTool = Store.lsTool;
/**
* 消防实力统计
*/
class FireStrength extends Component {
constructor(props) {
super(props);
this.state = {
......@@ -18,113 +17,78 @@ class FireStrength extends Component {
};
}
componentDidMount() {
}
componentDidMount() {}
onClick = () =>{
let sbm = null
onClick = () => {
let sbm = null;
let systemMenu = JSON.parse(lsTool.read(sessionConsts.systemMenu)) || [];
systemMenu.map(e =>{
if(e.permissionName && e.permissionName==="消防实力情况" ){
systemMenu.map(e => {
if (e.permissionName && e.permissionName === '消防实力情况') {
sbm = e;
}
})
if(sbm!==null){
window.localStorage.setItem('submenu',JSON.stringify(sbm.children));
});
if (sbm !== null) {
window.localStorage.setItem('submenu', JSON.stringify(sbm.children));
}
}
};
render() {
return (
<div className="FireStrength">
{/* <FireStrengthDetail /> */}
<div className="strength-safety-content">
<div className="strength-safety-font">消防实力情况(累计) </div>
{/* <div className="item" style={{marginTop:"0%"}} onClick={this.onClick} >
<div className="item-content"> <div className="item-img-div"><img className="item-img"src='/src/assets/homePage/xfsl/zzxfd.png'/></div><span>驻站消防队:</span><span className="item-value">18支</span> </div>
</div>
<div className="item">
<div className="item-content"> <div className="item-img-div"><img className="item-img"src='/src/assets/homePage/xfsl/zzxfy.png'/></div><span>驻站消防员:</span><span className="item-value">300人</span> </div>
</div>
<div className="item">
<div className="item-content"> <div className="item-img-div"><img className="item-img"src='/src/assets/homePage/xfsl/znzs.png'/></div><span>站内值守:</span><span className="item-value">200人</span> </div>
</div>
<div className="item">
<div className="item-content"> <div className="item-img-div"><img className="item-img"src='/src/assets/homePage/xfsl/xfc.png'/></div><span>消防车:</span><span className="item-value">50辆</span> </div>
</div>
<div className="item">
<div className="item-content"> <div className="item-img-div"> <img className="item-img"src='/src/assets/homePage/xfsl/xfqc.png'/></div><span>消防器材:</span><span className="item-value">20000件</span> </div>
</div> */}
<div className="strength-safety-tongji" >
<div className="strength-safety-content">
<div className="strength-safety-font">消防实力情况(累计) </div>
<div className="strength-safety-tongji">
<div className="content-tongji" onClick={this.onClick}>
<div className="left-div">
<span className='titleIcon-zzxfd'></span>
<span className="titleIcon-zzxfd"></span>
</div>
<span className='strength-safety-wenzi'>驻站消防队</span>
<span className="strength-safety-wenzi">驻站消防队</span>
<span className="right-font">100</span>
</div>
</div>
<div className="strength-safety-tongji">
<div className="content-tongji" onClick={this.onClick}>
<div className="content-tongji" onClick={this.onClick}>
<div className="left-div">
<span className='titleIcon-zzxfy' ></span>
<span className="titleIcon-zzxfy"></span>
</div>
<span className='strength-safety-wenzi'>驻站消防员</span>
<span className="strength-safety-wenzi">驻站消防员</span>
<span className="right-font">123</span>
</div>
</div>
<div className="strength-safety-tongji">
<div className="content-tongji" onClick={this.onClick}>
<div className="left-div">
<span className='titleIcon-znzs' ></span>
<span className="titleIcon-znzs"></span>
</div>
<span className='strength-safety-wenzi'>站内值守</span>
<span className="strength-safety-wenzi">站内值守</span>
<span className="right-font">100</span>
</div>
</div>
<div className="strength-safety-tongji">
<div className="content-tongji" onClick={this.onClick}>
<div className="left-div">
<span className='titleIcon-xfc'></span>
<span className="titleIcon-xfc"></span>
</div>
<span className='strength-safety-wenzi'>消防车</span>
<span className="strength-safety-wenzi">消防车</span>
<span className="right-font">14445</span>
</div>
</div>
<div className="strength-safety-tongji">
<div className="content-tongji">
<div className="left-div">
<span className='titleIcon-xfqc' ></span>
<span className="titleIcon-xfqc"></span>
</div>
<span className='strength-safety-wenzi'>消防器材</span>
<span className="strength-safety-wenzi">消防器材</span>
<span className="right-font">800</span>
</div>
</div>
</div>
<Modal
width={1000}
height={1000}
content={<FireStrengthDetail/>}
visible={false}
></Modal>
<Modal width={1000} height={1000} content={<FireStrengthDetail />} visible={false}></Modal>
</div>
);
}
}
FireStrength.propTypes = {
};
FireStrength.propTypes = {};
export default FireStrength;
......@@ -13,12 +13,12 @@ class InputTable extends Component {
pageSize: props.outterPageConfig ? props.outterPageConfig.pageSize : 10
};
this.state = {
loading: false,//页面是否加载中,默认false
dataList: [],//表格数据集合
size: 'middle',//表格大小
current: props.defaultPageConfig ? props.defaultPageConfig.current : 1,//当前页初始索引0
pageSize: props.defaultPageConfig ? props.defaultPageConfig.pageSize : 10,//当前页数据量
totals: 1,//所有数据总和
loading: false, //页面是否加载中,默认false
dataList: [], //表格数据集合
size: 'middle', //表格大小
current: props.defaultPageConfig ? props.defaultPageConfig.current : 1, //当前页初始索引0
pageSize: props.defaultPageConfig ? props.defaultPageConfig.pageSize : 10, //当前页数据量
totals: 1, //所有数据总和
maxHeight: 250
};
}
......@@ -36,9 +36,9 @@ class InputTable extends Component {
window.removeEventListener('resize', this.onWindowResize);
}
onWindowResize = (e) => {
onWindowResize = e => {
this.getHeightOffset();
}
};
/**
* 设置页面数据大小事件
......@@ -46,65 +46,66 @@ class InputTable extends Component {
onSizeChange = (current, pageSize) => {
let { setPageConfig } = this.props;
setPageConfig && setPageConfig({ current, pageSize });
this.setState({ current, pageSize },this.reload);
}
this.setState({ current, pageSize }, this.reload);
};
/**
* 设置当前页事件
*/
onPaginationChange = (current) => {
onPaginationChange = current => {
let { setPageConfig } = this.props;
setPageConfig && setPageConfig({ current });
this.setState({ current },this.reload);
}
this.setState({ current }, this.reload);
};
setPageConfig = ({ pageSize,current }) => {
setPageConfig = ({ pageSize, current }) => {
if (pageSize !== undefined) {
this.pageConfig.pageSize = pageSize;
}
if (current !== undefined) {
this.pageConfig.current = current;
}
}
};
/**
* 获取表格数据(刷新)
*/
reload = () => {
let { current,pageSize } = this.state;
// this.props.getTableDataAction({ current: current - 1, pageSize });
// this.getHeightOffset();
}
showTotal = (total) => {
};
showTotal = total => {
return `共 ${total} 条`;
}
};
generateRowkey = (record, index) => {
return record.id ? record.id : index + (this.state.current - 1) * this.state.pageSize;
}
};
getHeightOffset = () => {
let { getPanelHeight } = this.props;
let height = getPanelHeight === undefined ? '850' : getPanelHeight();
height && this.setState({ maxHeight: height });
}
};
render() {
let { size, loading, maxHeight } = this.state;
let { columns, dataSource, totals, pagination } = this.props;
let defaultPageConfig = this.pageConfig;
let rowKey = this.generateRowkey;
let _tempPagination = pagination === false ? false : pagination || {
size: 'small',
total: totals,
current: this.state.current,
pageSize: this.state.pageSize,
onShowSizeChange: this.onSizeChange,
onChange: this.onPaginationChange,
showSizeChanger: true,
showTotal: this.showTotal
};
let _tempPagination =
pagination === false
? false
: pagination || {
size: 'small',
total: totals,
current: this.state.current,
pageSize: this.state.pageSize,
onShowSizeChange: this.onSizeChange,
onChange: this.onPaginationChange,
showSizeChanger: true,
showTotal: this.showTotal
};
let bordered = true;
// 当为true 或 undefined时则分页
let _pagination = _tempPagination;
......
......@@ -3,9 +3,7 @@ import { RiskControlDetailAction } from './../../../services/centerLevelService'
import moment from 'moment';
const format = 'YYYY-MM-dd';
export default class ModelContent extends Component {
constructor(props) {
super(props);
this.state = {
......@@ -13,25 +11,25 @@ export default class ModelContent extends Component {
};
}
componentDidMount(){
componentDidMount() {
let { type } = this.props;
this.RiskControlDetail(type);
}
RiskControlDetail = (type) => {
RiskControlDetail = type => {
RiskControlDetailAction(type).then(data => {
this.setState({
alarmData: data
});
});
}
};
/**
* 获取标题
*
* @memberof ModelContent
*/
getTitle = (v) => {
getTitle = v => {
const titleParams = {
1: '一级风险点', //一级风险点
2: '二级风险点', //二级风险点
......@@ -39,39 +37,39 @@ export default class ModelContent extends Component {
4: '四级风险点' //四级风险点
};
return titleParams[v];
}
};
formatData = (str) => {
formatData = str => {
let date = str.split(' ')[0];
return date;
}
};
renderContent = (content) =>{
renderContent = content => {
return (
<div className='rows'>
<div className="rows">
{(content || []).map(itemA => {
return (
<div className='row'>
<div className="row">
<span>{itemA.name}</span>
<span className='date'>{this.formatData(itemA.changeDate)}</span>
<span className="date">{this.formatData(itemA.changeDate)}</span>
</div>
);
})}
</div>
);
}
};
render() {
let { alarmData } = this.state;
let { type } = this.props;
return (
<div className='model-content'>
<div className="model-content">
{(alarmData || []).map(item => {
return (
<div className='content-div'>
<div className='title'>
<div className="content-div">
<div className="title">
<span>|</span>
<span className='next-title'>{ type === 'risk' ? this.getTitle(item.typeCode) : item.typeName }</span>
<span className="next-title">{type === 'risk' ? this.getTitle(item.typeCode) : item.typeName}</span>
</div>
{this.renderContent(item.content)}
</div>
......
This diff is collapsed.
import React, { Component } from 'react';
import AmosWebSocket from 'amos-websocket';
import AlarmControl from './AlarmControl';
import DangerControl from './DangerControl';
import RiskControl from './RiskControl';
import AllSafety from './AllSafety';
import FireSafety from './FireSafety';
import FireStrength from './FireStrength';
import AmosWebSocket from 'amos-websocket';
import SysWsURL, { completeToken } from './../../../consts/wsUrlConsts';
import { Modal, Select } from 'amos-framework';
/**
* 中心级2侧模块
*/
export default class Statistical extends Component {
constructor(props) {
super(props);
this.state = {
visible: true
};
}
handleData = (data = {}) => {
......@@ -27,8 +23,7 @@ export default class Statistical extends Component {
data = JSON.parse(JSON.stringify(data));
console.log(data);
let refreshType = data.refreshType;
let content = data.content;
switch (refreshType){
switch (refreshType) {
case 'today_safety_index':
console.log('今日安全指数刷新~~~~~~~~~~~~~~~~~~~~');
this.RiskControl.getRiskControl();
......@@ -66,42 +61,32 @@ export default class Statistical extends Component {
this.FireStrength.FireStrengthData();
break;
default:
console.log(refreshType,':类型不支持');
console.log(refreshType, ':类型不支持');
}
}
};
cancel = () => {
this.setState({
visible: false
});
}
};
render() {
const { visible } = this.state;
const wsURL = completeToken(SysWsURL.viewIndexws);
return (
<div className="statistical">
<AmosWebSocket ref={node => this.aws = node} url={wsURL} onMessage={this.handleData} reconnect debug />
<AmosWebSocket ref={node => (this.aws = node)} url={wsURL} onMessage={this.handleData} reconnect debug />
<div className="statistical-left">
<RiskControl ref={node => this.RiskControl = node} />
<DangerControl ref={node => this.safetyExecute = node} />
<AlarmControl ref={node => this.equipStatus = node} />
<RiskControl ref={node => (this.RiskControl = node)} />
<DangerControl ref={node => (this.safetyExecute = node)} />
<AlarmControl ref={node => (this.equipStatus = node)} />
</div>
<div className="statistical-right">
<AllSafety ref={node => this.AllSafety = node} />
<FireSafety ref={node => this.FireSafety = node} />
<FireStrength ref={node => this.FireStrength = node} />
<AllSafety ref={node => (this.AllSafety = node)} />
<FireSafety ref={node => (this.FireSafety = node)} />
<FireStrength ref={node => (this.FireStrength = node)} />
</div>
</div>
);
}
}
import React, { Component } from 'react';
import AmosWebSocket from 'amos-websocket';
import AlarmControl from './AlarmControl';
import DangerControl from './DangerControl';
import RiskControl from './RiskControl';
import AmosWebSocket from 'amos-websocket';
import SysWsURL, { completeToken } from './../../../consts/wsUrlConsts';
/**
......@@ -12,41 +11,20 @@ import SysWsURL, { completeToken } from './../../../consts/wsUrlConsts';
export default class StatisticalLeft extends Component {
constructor(props) {
super(props);
this.state = {
};
}
ondetails = (type) => {
this.props.ondetails(type);
};
componentWillMount = () => {
};
componentWillReceiveProps = (nextProps) => {
}
componentWillMount() {
}
handleData = (data = {}) => {
console.log('ws data:', data);
data = JSON.parse(JSON.stringify(data));
console.log(data);
let refreshType = data.refreshType;
let content = data.content;
switch (refreshType){
case 'today_safety_index':
console.log('今日安全指数刷新~~~~~~~~~~~~~~~~~~~~');
......@@ -77,13 +55,12 @@ export default class StatisticalLeft extends Component {
render() {
const wsURL = completeToken(SysWsURL.viewIndexws);
const { flag } = this.state;
return (
<div className="statistical-left">
<AmosWebSocket ref={node => this.aws = node} url={wsURL} onMessage={this.handleData} reconnect debug />
<RiskControl ondetails={this.ondetails} />
<DangerControl ondetails={this.ondetails} />
<AlarmControl ondetails={this.ondetails} />
<RiskControl />
<DangerControl />
<AlarmControl />
</div>
);
}
......
......@@ -10,14 +10,12 @@ import SysWsURL, { completeToken } from '../../../consts/wsUrlConsts';
* 全景监控统计
*/
export default class StatisticalRight extends Component {
handleData = (data = {}) => {
console.log('ws data:', data);
data = JSON.parse(JSON.stringify(data));
console.log(data);
let refreshType = data.refreshType;
let content = data.content;
switch (refreshType){
switch (refreshType) {
case 'error_status':
console.log('异常区域刷新~~~~~~~~~~~~~~~~~~~~');
break;
......@@ -40,19 +38,18 @@ export default class StatisticalRight extends Component {
this.FireStrength.FireStrengthData();
break;
default:
console.log(refreshType,':类型不支持');
console.log(refreshType, ':类型不支持');
}
}
};
render() {
const wsURL = completeToken(SysWsURL.viewIndexws);
return (
<div className="statistical-right">
<AmosWebSocket ref={node => this.aws = node} url={wsURL} onMessage={this.handleData} reconnect debug />
<AllSafety ref={node => this.AllSafety = node} />
<FireSafety ref={node => this.FireSafety = node} />
<FireStrength ref={node => this.FireStrength = node} />
<AmosWebSocket ref={node => (this.aws = node)} url={wsURL} onMessage={this.handleData} reconnect debug />
<AllSafety ref={node => (this.AllSafety = node)} />
<FireSafety ref={node => (this.FireSafety = node)} />
<FireStrength ref={node => (this.FireStrength = node)} />
</div>
);
}
......
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