| | |
| | | <template> |
| | | <div class="charts-cont"> |
| | | <div class="choose"> |
| | | <div :class="choose" > |
| | | <div :class="cur===1?'act':''" @click="changeTab(1)">月度</div> |
| | | <div :class="cur===2?'act':''" @click="changeTab(2)">年度</div> |
| | | </div> |
| | |
| | | </template> |
| | | |
| | | <script lang="ts"> |
| | | import {toRefs, reactive, defineComponent, ref, defineAsyncComponent, onMounted, nextTick, onUnmounted} from 'vue'; |
| | | import {toRefs, reactive, defineComponent, ref, defineAsyncComponent, onMounted, nextTick, onUnmounted, watchEffect} from 'vue'; |
| | | import { storeToRefs } from 'pinia'; |
| | | import { initBackEndControlRoutes } from '/@/router/backEnd'; |
| | | import {useUserInfo} from "/@/stores/userInfo"; |
| | |
| | | import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; |
| | | import * as echarts from "echarts"; |
| | | import '/@/theme/bigScreen.css' |
| | | |
| | | import {useScreenTheme} from "/@/stores/screenTheme" |
| | | |
| | | interface stateType { |
| | | cur: number |
| | | cur: number, |
| | | curColor: string, |
| | | choose: string |
| | | } |
| | | export default defineComponent({ |
| | | name: 'accident', |
| | | components: {}, |
| | | props:{ |
| | | size: Number |
| | | size: Number, |
| | | theme: Boolean |
| | | }, |
| | | setup(props) { |
| | | const userInfo = useUserInfo() |
| | | const { userInfos } = storeToRefs(userInfo); |
| | | const screenThemes = useScreenTheme() |
| | | const { screenTheme } = storeToRefs(screenThemes); |
| | | const accidentMonth = ref("eChartFix" + Date.now() + Math.random()) |
| | | const accidentYear = ref("eChartFix" + Date.now() + Math.random()) |
| | | const state = reactive<stateType>({ |
| | | cur: 1 |
| | | cur: 1, |
| | | curColor: '#fff', |
| | | choose: 'choose-dark' |
| | | }) |
| | | |
| | | const changeTab =(i)=>{ |
| | |
| | | itemWidth: fontSize(10), |
| | | itemHeight: fontSize(8), |
| | | textStyle:{ |
| | | color: '#fff', |
| | | color: 'auto', |
| | | fontSize: fontSize(11) |
| | | } |
| | | }, |
| | |
| | | { |
| | | name: '月度数据', |
| | | type: 'pie', |
| | | radius: ['45%', '70%'], |
| | | radius: ['50%', '80%'], |
| | | avoidLabelOverlap: false, |
| | | itemStyle: { |
| | | borderRadius: fontSize(4) |
| | | borderRadius: fontSize(2) |
| | | }, |
| | | label: { |
| | | show: false, |
| | | position: 'outer', |
| | | fontSize: fontSize(10), |
| | | color: '#ffffff', |
| | | textBorderWidth: 0, |
| | | width: fontSize(40), |
| | | overflow: 'break' |
| | |
| | | } |
| | | }, |
| | | data: [ |
| | | { value: 1048, name: '特别重大事故' }, |
| | | { value: 735, name: '重大事故' }, |
| | | { value: 580, name: '较大事故' }, |
| | | { value: 484, name: '一般事故' }, |
| | | { value: 300, name: '未遂事故' } |
| | | { value: 1, name: '特别重大事故' }, |
| | | { value: 10, name: '重大事故' }, |
| | | { value: 20, name: '较大事故' }, |
| | | { value: 33, name: '一般事故' }, |
| | | { value: 50, name: '未遂事故' } |
| | | ], |
| | | center: ['50%','60%'] |
| | | } |
| | |
| | | itemWidth: fontSize(10), |
| | | itemHeight: fontSize(8), |
| | | textStyle:{ |
| | | color: '#fff', |
| | | color: 'auto', |
| | | fontSize: fontSize(11) |
| | | } |
| | | }, |
| | |
| | | { |
| | | name: '年度数据', |
| | | type: 'pie', |
| | | radius: ['45%', '70%'], |
| | | radius: ['50%', '80%'], |
| | | avoidLabelOverlap: false, |
| | | itemStyle: { |
| | | borderRadius: fontSize(4) |
| | | borderRadius: fontSize(2) |
| | | }, |
| | | label: { |
| | | show: false, |
| | | position: 'outer', |
| | | fontSize: fontSize(10), |
| | | color: '#ffffff', |
| | | textBorderWidth: 0, |
| | | width: fontSize(40), |
| | | overflow: 'break' |
| | |
| | | } |
| | | }, |
| | | data: [ |
| | | { value: 1048, name: '特别重大事故' }, |
| | | { value: 735, name: '重大事故' }, |
| | | { value: 580, name: '较大事故' }, |
| | | { value: 484, name: '一般事故' }, |
| | | { value: 300, name: '未遂事故' } |
| | | { value: 10, name: '特别重大事故' }, |
| | | { value: 20, name: '重大事故' }, |
| | | { value: 100, name: '较大事故' }, |
| | | { value: 130, name: '一般事故' }, |
| | | { value: 150, name: '未遂事故' } |
| | | ], |
| | | center: ['50%','60%'] |
| | | } |
| | |
| | | }); |
| | | } |
| | | |
| | | |
| | | function fontSize(val){ |
| | | let nowClientWidth = document.documentElement.clientWidth; |
| | | return val * (nowClientWidth/1920) * Number(props.size); |
| | | } |
| | | const getTheme =()=>{ |
| | | if(screenTheme.value.isDark){ |
| | | state.choose = 'choose-dark' |
| | | }else{ |
| | | state.choose = 'choose-light' |
| | | } |
| | | } |
| | | |
| | | watchEffect(() => { |
| | | if(props.theme){ |
| | | state.choose = 'choose-dark' |
| | | }else{ |
| | | state.choose = 'choose-light' |
| | | } |
| | | }) |
| | | |
| | | |
| | | // 页面载入时执行方法 |
| | | onMounted(() => { |
| | | initAccidentByMonth(); |
| | | getTheme() |
| | | // initAccidentByYear(); |
| | | }); |
| | | |
| | |
| | | padding: 5%; |
| | | position: relative; |
| | | |
| | | .choose{ |
| | | .choose-dark{ |
| | | position: absolute; |
| | | right: 5%; |
| | | bottom: 20px; |
| | | right: 4%; |
| | | bottom: 4%; |
| | | z-index: 999; |
| | | display: flex; |
| | | align-items: center; |
| | |
| | | border: 1px solid #11FEEE; |
| | | } |
| | | } |
| | | .choose-light{ |
| | | position: absolute; |
| | | right: 4%; |
| | | bottom: 4%; |
| | | z-index: 999; |
| | | display: flex; |
| | | align-items: center; |
| | | font-size: 0.75rem; |
| | | justify-content: space-between; |
| | | |
| | | div{ |
| | | padding: 2px 6px; |
| | | box-sizing: border-box; |
| | | color: #ccc; |
| | | border: 1px solid #ccc; |
| | | border-radius: 2px; |
| | | cursor: pointer; |
| | | } |
| | | div:hover{ |
| | | color: #333; |
| | | border: 1px solid #333; |
| | | } |
| | | .act{ |
| | | color: #333; |
| | | border: 1px solid #333; |
| | | } |
| | | } |
| | | .month{ |
| | | width: 100%; |
| | | height: 100%; |