| | |
| | | size: Number, |
| | | theme: Boolean |
| | | }, |
| | | setup(props) { |
| | | setup(props,context) { |
| | | const userInfo = useUserInfo() |
| | | const { userInfos } = storeToRefs(userInfo); |
| | | const screenThemes = useScreenTheme() |
| | |
| | | state.timeValue[1] = Number(temp[1]) |
| | | } |
| | | 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().getRiskByTimeDep(data); |
| | | if (res.data.code === '200') { |
| | | state.accData = res.data.data[0].detail |
| | | const oneList = res.data.data[0].detail[0].count |
| | | const twoList = res.data.data[0].detail[1].count |
| | | const threeList = res.data.data[0].detail[2].count |
| | | const fourList = res.data.data[0].detail[3].count |
| | | const fiveList = res.data.data[0].detail[4].count |
| | | initAccidentByMonth(oneList,twoList,threeList,fourList,fiveList) |
| | | state.accData = res.data.data |
| | | initAccidentByMonth(state.accData) |
| | | context.emit('getData',state.accData) |
| | | } else { |
| | | ElMessage({ |
| | | type: 'warning', |
| | |
| | | |
| | | type EChartsOption = echarts.EChartsOption |
| | | // 隐患整改情况 |
| | | const initAccidentByMonth =(one:number,two:number,three:number,four:number,five:number)=>{ |
| | | const initAccidentByMonth =(data)=>{ |
| | | let dom = document.getElementById(accidentMonth.value); |
| | | let myChart = echarts.init(dom); |
| | | |
| | |
| | | fontWeight: 'bold' |
| | | } |
| | | }, |
| | | data: [ |
| | | { value: one, name: '特别重大事故' }, |
| | | { value: two, name: '重大事故' }, |
| | | { value: three, name: '较大事故' }, |
| | | { value: four, name: '一般事故' }, |
| | | { value: five, name: '未遂事故' } |
| | | ], |
| | | data: data.map(i=>{ |
| | | return { |
| | | name: i.accidentGrade, |
| | | value: i.count |
| | | } |
| | | }), |
| | | center: ['50%','60%'] |
| | | } |
| | | ] |
| | |
| | | }else{ |
| | | state.selector = 'select-light' |
| | | } |
| | | getDataByYearId() |
| | | // getDataByYearId() |
| | | }) |
| | | |
| | | const changeTime = (value)=>{ |
| | |
| | | getTime(); |
| | | makeList(); |
| | | getDataByYearId(); |
| | | // initAccidentByYear(); |
| | | }); |
| | | |
| | | onUnmounted(() =>{ |