| | |
| | | size: Number, |
| | | theme: Boolean |
| | | }, |
| | | setup(props) { |
| | | setup(props,context) { |
| | | const userInfo = useUserInfo() |
| | | const { userInfos } = storeToRefs(userInfo); |
| | | const screenThemes = useScreenTheme() |
| | |
| | | const changeTime = (value)=>{ |
| | | state.timeValue[0] = value[0] |
| | | state.timeValue[1] = value[1] |
| | | getDataByYearId() |
| | | } |
| | | |
| | | const getDataByYearId = async () => { |
| | | getTime() |
| | | const data = { |
| | | depId: screenTheme.value.depId || 1, |
| | | beginYear: state.timeValue[0], |
| | | beginMonth: state.timeValue[1], |
| | | endYear: state.timeValue[0], |
| | | endMonth: state.timeValue[1] |
| | | year: state.timeValue[0], |
| | | month: state.timeValue[1], |
| | | } |
| | | if(state.timeValue[1] == 0){ |
| | | data.beginMonth = 1 |
| | | data.endMonth = 12 |
| | | data.month = '' |
| | | } |
| | | let res = await riskWarningApi().getSelfPreventByTimeDep(data); |
| | | let res = await riskWarningApi().getDpGrade(data); |
| | | if (res.data.code === '200') { |
| | | state.dangerData = res.data.data |
| | | const danger = [ |
| | | {value: state.dangerData[0].detail.lightRiskCount,name: '一般隐患'}, |
| | | {value: state.dangerData[0].detail.heavyRiskCount,name: '重大隐患'} |
| | | ] |
| | | initdangerByMonth(danger) |
| | | initdangerByMonth(state.dangerData) |
| | | context.emit('getData',state.dangerData) |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | |
| | | |
| | | type EChartsOption = echarts.EChartsOption |
| | | // 隐患整改情况 |
| | | const initdangerByMonth =(danger)=>{ |
| | | const initdangerByMonth =(data)=>{ |
| | | let dom = document.getElementById(dangerMonth.value); |
| | | let myChart = echarts.init(dom); |
| | | |
| | |
| | | tooltip: { |
| | | trigger: 'item' |
| | | }, |
| | | color: ['#FAC858','#EE6666'], |
| | | legend: { |
| | | top: '8%', |
| | | left: 'center', |
| | |
| | | fontWeight: 'bold' |
| | | } |
| | | }, |
| | | data: danger, |
| | | data: [ |
| | | { |
| | | name: 'A级', |
| | | value: data.a |
| | | }, |
| | | { |
| | | name: 'B级', |
| | | value: data.b |
| | | }, |
| | | { |
| | | name: 'C级', |
| | | value: data.c |
| | | } |
| | | ], |
| | | center: ['50%','55%'] |
| | | } |
| | | ] |
| | |
| | | }else{ |
| | | state.selector = 'select-light' |
| | | } |
| | | getDataByYearId() |
| | | // getDataByYearId() |
| | | }) |
| | | |
| | | // 页面载入时执行方法 |