|
|
@ -1,42 +1,115 @@ |
|
|
|
import React, { useEffect, useState } from 'react' |
|
|
|
import { connect } from 'react-redux'; |
|
|
|
import moment from 'moment'; |
|
|
|
import ApproveModal from '../components/groupModal'; |
|
|
|
|
|
|
|
import ReactECharts from 'echarts-for-react'; |
|
|
|
|
|
|
|
import { Tabs, Form, Input, DatePicker, Button, Table, Select } from 'antd'; |
|
|
|
import { v1 } from 'uuid'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function MyApplication ({ loading, clientHeight, actions, dispatch, user }) { |
|
|
|
|
|
|
|
const { resourceConsumption } = actions |
|
|
|
const { dataQuality } = actions |
|
|
|
|
|
|
|
const [query, setQuery] = useState({ page: 0, limit: 10 }); |
|
|
|
const [proTableList, setProTableList] = useState({ rows: [], count: 0 }); |
|
|
|
const [formData, setFormData] = useState({}) |
|
|
|
const [bistribution, setBistribution] = useState({}) |
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
resourceData() |
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
|
|
let resourceData = (params) => { |
|
|
|
// let data = params || query
|
|
|
|
// dispatch(resourceConsumption.getApproveList({ applyById: user?.id, ...formData, ...data, })).then(res => {
|
|
|
|
// if (res.success) {
|
|
|
|
// setProTableList(res.payload.data)
|
|
|
|
// }
|
|
|
|
// })
|
|
|
|
let resourceData = () => { |
|
|
|
dispatch(dataQuality.getBusinessRules({})).then(res => { |
|
|
|
if (res.success) { |
|
|
|
let data = res.payload.data?.rows |
|
|
|
setBistribution({ |
|
|
|
ordinary: data?.filter(c => c.problemLevel == '一般')?.length || 0, |
|
|
|
significance: data?.filter(c => c.problemLevel == '重要')?.length || 0, |
|
|
|
seriousness: data?.filter(c => c.problemLevel == '严重')?.length || 0, |
|
|
|
count: res.payload.data?.count |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const option = { |
|
|
|
title: { |
|
|
|
text: '规则分部情况', |
|
|
|
subtext: '', |
|
|
|
x: 'center' |
|
|
|
}, |
|
|
|
tooltip: { |
|
|
|
trigger: 'item', |
|
|
|
formatter: "{a} <br/>{b} : {c} ({d}%)" |
|
|
|
}, |
|
|
|
legend: { |
|
|
|
orient: 'vertical', |
|
|
|
left: 'right', |
|
|
|
data: ['一般', '重要', '严重'] |
|
|
|
}, |
|
|
|
series: [ |
|
|
|
{ |
|
|
|
name: '分布情况', |
|
|
|
type: 'pie', |
|
|
|
radius: '55%', |
|
|
|
center: ['50%', '60%'], |
|
|
|
data: [ |
|
|
|
{ value: bistribution?.ordinary, name: '一般' }, |
|
|
|
{ value: bistribution?.significance, name: '重要' }, |
|
|
|
{ value: bistribution?.seriousness, name: '严重' }, |
|
|
|
], |
|
|
|
itemStyle: { |
|
|
|
emphasis: { |
|
|
|
shadowBlur: 10, |
|
|
|
shadowOffsetX: 0, |
|
|
|
shadowColor: 'rgba(0, 0, 0, 0.5)' |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
}; |
|
|
|
|
|
|
|
const [count, setCount] = useState(0); |
|
|
|
|
|
|
|
function onChartReady (echarts) { |
|
|
|
console.log('echarts is ready', echarts); |
|
|
|
} |
|
|
|
|
|
|
|
function onChartClick (param, echarts) { |
|
|
|
console.log(param, echarts); |
|
|
|
setCount(count + 1); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
function onChartLegendselectchanged (param, echarts) { |
|
|
|
console.log(param, echarts); |
|
|
|
}; |
|
|
|
|
|
|
|
return <div style={{ width: '100%', display: 'flex', justifyContent: 'center' }}> |
|
|
|
<div style={{ width: '80%' }}> |
|
|
|
<div style={{ fontSize: 24, fontWeight: 600, }}>业务规则情况</div> |
|
|
|
<div style={{ border: '1px solid #38333326', margin: '20px 0' }}></div> |
|
|
|
<div style={{ display: 'flex' }}> |
|
|
|
<div style={{ width: 200, h: 400, display: 'flex', alignItems: 'center', justifyContent: 'flex-end' }}> |
|
|
|
业务规则个数:<span style={{fontSize: 24, fontWeight: 600,}}>{bistribution?.count || 0} </span> 个</div> |
|
|
|
<ReactECharts |
|
|
|
option={option} |
|
|
|
style={{ height: 400, width: 600 }} |
|
|
|
onChartReady={onChartReady} |
|
|
|
onEvents={{ |
|
|
|
'click': onChartClick, |
|
|
|
'legendselectchanged': onChartLegendselectchanged |
|
|
|
}} |
|
|
|
/> |
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
return <> |
|
|
|
</> |
|
|
|
</div> |
|
|
|
} |
|
|
|
function mapStateToProps (state) { |
|
|
|
const { global, auth, resourceCatalog } = state; |
|
|
|