From 1b9fea7d4af68d8f933b2dc42bf6084b9646f64c Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期二, 04 三月 2025 08:39:55 +0800 Subject: [PATCH] 修改作业等级名称 --- src/views/riskWarningSys/warningBigScreen/components/educate.vue | 60 +++++++++++++++++++++++++++++++++++------------------------- 1 files changed, 35 insertions(+), 25 deletions(-) diff --git a/src/views/riskWarningSys/warningBigScreen/components/educate.vue b/src/views/riskWarningSys/warningBigScreen/components/educate.vue index f85cc76..34e1d19 100644 --- a/src/views/riskWarningSys/warningBigScreen/components/educate.vue +++ b/src/views/riskWarningSys/warningBigScreen/components/educate.vue @@ -18,26 +18,44 @@ import { workApplyApi } from '/@/api/specialWorkSystem/workApply'; import * as echarts from 'echarts'; import '/@/theme/bigScreen.css' + import {riskWarningApi} from "/@/api/riskWarning"; interface stateType { + educateData: [] } export default defineComponent({ - name: 'risk', + name: 'educate', components: {}, props:{ size: Number }, - setup(props) { + setup(props,context) { const userInfo = useUserInfo() const { userInfos } = storeToRefs(userInfo); const educate = ref("eChartEdu" + Date.now() + Math.random()) const state = reactive<stateType>({ - + educateData: [] }) + + const getTrainInfo = async () => { + let res = await riskWarningApi().getTrainInfo(); + if (res.data.code === '200') { + state.educateData = res.data.data + initEducate(state.educateData) + context.emit('getData',state.educateData) + } else { + ElMessage({ + type: 'warning', + message: res.data.msg + }); + } + } + + type EChartsOption = echarts.EChartsOption // 隐患整改情况 - const initEducate =()=>{ + const initEducate =(data)=>{ let dom = document.getElementById(educate.value); let myChart = echarts.init(dom); @@ -46,30 +64,30 @@ option = { color: ['#67F9D8', '#FFE434', '#56A3F1', '#FF917C'], legend: { - top: '5%', left: 'center', + itemWidth: fontSize(10), + itemHeight: fontSize(8), textStyle:{ - color: '#fff', + color: 'auto', fontSize: fontSize(11) } }, radar: [ { - indicator: [ - { text: '设计培训次数' }, - { text: '培训时间(小时)' }, - { text: '完成比例(%)' } - ], - center: ['50%', '60%'], - radius: fontSize(60), + indicator: data.map(i=>{ + const {name} = i + return {name} + }), + center: ['50%', '50%'], + radius: fontSize(65), startAngle: 90, splitNumber: 4, shape: 'circle', axisName: { formatter: '{value}', color: '#428BD4', - fontSize: fontSize(10), - width: 20, + fontSize: fontSize(9), + width: 10, overflow: 'break' }, splitArea: { @@ -101,15 +119,7 @@ }, data: [ { - value: [100, 8, 0.4, -80, 2000], - name: '企业汇总' - }, - { - value: [60, 5, 0.3, -100, 1500], - name: '事业部A', - areaStyle: { - color: 'rgba(255, 228, 52, 0.6)' - } + value: data.map(i=>i.count), } ] }, @@ -128,7 +138,7 @@ // 页面载入时执行方法 onMounted(() => { - initEducate(); + getTrainInfo() }); return { -- Gitblit v1.9.2