Browse Source

(*)首页 优化

master
wuqun 2 years ago
parent
commit
511896653f
  1. 32
      web/client/src/sections/shouye/components/alarm/alarmStatistics.js
  2. 8
      web/client/src/sections/shouye/containers/shouye.js

32
web/client/src/sections/shouye/components/alarm/alarmStatistics.js

@ -6,32 +6,30 @@ class AlarmStatistics extends Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.state = { this.state = {
workers: { alarmList: [
wTypePieData: [ { item: '点位1', count: 214 },
{ item: '点位1', count: 214 }, { item: '点位2', count: 135 },
{ item: '点位2', count: 135 }, { item: '点位3', count: 88 },
{ item: '点位3', count: 88 }, { item: '点位4', count: 63 },
{ item: '点位4', count: 63 }, { item: '点位5', count: 56 },
{ item: '点位5', count: 56 }, { item: '点位6', count: 115 },
{ item: '点位6', count: 115 }, { item: '点位7', count: 67 },
{ item: '点位7', count: 67 }, { item: '点位8', count: 144 },
{ item: '点位8', count: 144 }, { item: '点位9', count: 21 },
{ item: '点位9', count: 21 }, { item: '点位10', count: 83 },
{ item: '点位10', count: 83 }, ]
]
}
} }
} }
render() { render() {
const { height } = this.props; const { height } = this.props;
const { workers } = this.state; const { alarmList } = this.state;
let max = null, content = null; let max = null, content = null;
let data = workers.wTypePieData.sort((a, b) => b.count - a.count); let data = alarmList.sort((a, b) => b.count - a.count);
max = data[0].count; max = data[0].count;
content = <div style={{ padding: '0px 10px 30px 30px' }}> content = <div style={{ padding: '0px 10px 30px 30px' }}>
{ {
workers.wTypePieData.map((wd, i) => { alarmList.map((wd, i) => {
let cls = i < 3 ? 'alarm-row rank1' : 'alarm-row rank2'; let cls = i < 3 ? 'alarm-row rank1' : 'alarm-row rank2';
return <Row style={{ marginBottom: 15 }}> return <Row style={{ marginBottom: 15 }}>
<Col offset={1} span={3}><span className={cls}>No.{i + 1}</span></Col> <Col offset={1} span={3}><span className={cls}>No.{i + 1}</span></Col>

8
web/client/src/sections/shouye/containers/shouye.js

@ -141,14 +141,14 @@ const Information = (props) => {
<div style={{ width: '45%' }}> <div style={{ width: '45%' }}>
<XColumn <XColumn
domId={'column-chart-1'} domId={'column-chart-1'}
height={clientHeight * 0.35} height={clientHeight * 0.32}
xAxis={chartData1.map(cd => cd.value).reverse()} xAxis={chartData1.map(cd => cd.value).reverse()}
yAxis={chartData1.map(cd => cd.name).reverse()} /> yAxis={chartData1.map(cd => cd.name).reverse()} />
</div> </div>
<div style={{ width: '45%' }}> <div style={{ width: '45%' }}>
<StackColumn <StackColumn
domId={'column-chart-2'} domId={'column-chart-2'}
height={clientHeight * 0.35} height={clientHeight * 0.32}
xAxis={chartData2.map(cd => cd.name)} xAxis={chartData2.map(cd => cd.name)}
yAxis1={chartData2.map(cd => cd.num)} yAxis1={chartData2.map(cd => cd.num)}
yAxis2={chartData2.map(cd => cd.repairNum)} /> yAxis2={chartData2.map(cd => cd.repairNum)} />
@ -156,12 +156,12 @@ const Information = (props) => {
</div> </div>
<div style={{ display: 'flex', justifyContent: 'space-between', marginTop : 12 }}> <div style={{ display: 'flex', justifyContent: 'space-between', marginTop : 12 }}>
<div style={{ width: '45%' }}> <div style={{ width: '45%' }}>
<AlarmStatistics height={clientHeight * 0.25} /> <AlarmStatistics height={clientHeight * 0.23} />
</div> </div>
<div style={{ width: '45%' }}> <div style={{ width: '45%' }}>
<Column <Column
domId={'column-chart-3'} domId={'column-chart-3'}
height={clientHeight * 0.35} height={clientHeight * 0.32}
xAxis={chartData4.map(cd => cd.name)} xAxis={chartData4.map(cd => cd.name)}
yAxis={chartData4.map(cd => cd.cost)} /> yAxis={chartData4.map(cd => cd.cost)} />
</div> </div>

Loading…
Cancel
Save