cd79d7ddc3814918e798d79337ef5af09f2afd6d5a5163bcc1d62aca55da4246.json 7.9 KB

1
  1. {"ast":null,"code":"import \"core-js/modules/es.iterator.constructor.js\";\nimport \"core-js/modules/es.iterator.map.js\";\nimport * as echarts from 'echarts';\nimport { getSafetyLevelStats } from '@/api';\nexport default {\n name: 'SafetyLevel',\n data() {\n return {\n chart: null\n };\n },\n async mounted() {\n const res = await getSafetyLevelStats();\n this.$nextTick(() => this.initChart(res.data));\n },\n beforeDestroy() {\n if (this.chart) this.chart.dispose();\n },\n methods: {\n initChart(data) {\n this.chart = echarts.init(this.$refs.chart);\n const colors = ['#f44336', '#ff9800', '#ffc107', '#4caf50'];\n const option = {\n tooltip: {\n trigger: 'axis',\n backgroundColor: 'rgba(13,34,71,0.9)',\n borderColor: '#1a3a6a',\n textStyle: {\n color: '#fff'\n }\n },\n legend: {\n top: 0,\n right: 0,\n textStyle: {\n color: '#8cb8e6',\n fontSize: 11\n },\n itemWidth: 12,\n itemHeight: 8\n },\n grid: {\n left: 80,\n right: 20,\n top: 35,\n bottom: 10\n },\n xAxis: {\n type: 'value',\n splitLine: {\n lineStyle: {\n color: 'rgba(26,58,106,0.4)'\n }\n },\n axisLine: {\n show: false\n },\n axisLabel: {\n color: '#8cb8e6',\n fontSize: 11\n }\n },\n yAxis: {\n type: 'category',\n data: data.departments.map(d => d.name),\n axisLine: {\n lineStyle: {\n color: '#1a3a6a'\n }\n },\n axisLabel: {\n color: '#8cb8e6',\n fontSize: 11\n },\n axisTick: {\n show: false\n }\n },\n series: [{\n name: '一级',\n type: 'bar',\n stack: 'total',\n barWidth: 16,\n data: data.departments.map(d => d.level1),\n itemStyle: {\n color: colors[0]\n }\n }, {\n name: '二级',\n type: 'bar',\n stack: 'total',\n data: data.departments.map(d => d.level2),\n itemStyle: {\n color: colors[1]\n }\n }, {\n name: '三级',\n type: 'bar',\n stack: 'total',\n data: data.departments.map(d => d.level3),\n itemStyle: {\n color: colors[2]\n }\n }, {\n name: '四级',\n type: 'bar',\n stack: 'total',\n data: data.departments.map(d => d.level4),\n itemStyle: {\n color: colors[3]\n }\n }]\n };\n this.chart.setOption(option);\n }\n }\n};","map":{"version":3,"names":["echarts","getSafetyLevelStats","name","data","chart","mounted","res","$nextTick","initChart","beforeDestroy","dispose","methods","init","$refs","colors","option","tooltip","trigger","backgroundColor","borderColor","textStyle","color","legend","top","right","fontSize","itemWidth","itemHeight","grid","left","bottom","xAxis","type","splitLine","lineStyle","axisLine","show","axisLabel","yAxis","departments","map","d","axisTick","series","stack","barWidth","level1","itemStyle","level2","level3","level4","setOption"],"sources":["src/components/LabStats/SafetyLevel.vue"],"sourcesContent":["<template>\n <div class=\"panel-box safety-level\">\n <div class=\"panel-title\">实验室安全分级统计</div>\n <div class=\"panel-content\">\n <div ref=\"chart\" class=\"chart-area\"></div>\n </div>\n </div>\n</template>\n\n<script>\nimport * as echarts from 'echarts'\nimport { getSafetyLevelStats } from '@/api'\n\nexport default {\n name: 'SafetyLevel',\n data() {\n return { chart: null }\n },\n async mounted() {\n const res = await getSafetyLevelStats()\n this.$nextTick(() => this.initChart(res.data))\n },\n beforeDestroy() {\n if (this.chart) this.chart.dispose()\n },\n methods: {\n initChart(data) {\n this.chart = echarts.init(this.$refs.chart)\n const colors = ['#f44336', '#ff9800', '#ffc107', '#4caf50']\n const option = {\n tooltip: {\n trigger: 'axis',\n backgroundColor: 'rgba(13,34,71,0.9)',\n borderColor: '#1a3a6a',\n textStyle: { color: '#fff' }\n },\n legend: {\n top: 0,\n right: 0,\n textStyle: { color: '#8cb8e6', fontSize: 11 },\n itemWidth: 12,\n itemHeight: 8\n },\n grid: { left: 80, right: 20, top: 35, bottom: 10 },\n xAxis: {\n type: 'value',\n splitLine: { lineStyle: { color: 'rgba(26,58,106,0.4)' } },\n axisLine: { show: false },\n axisLabel: { color: '#8cb8e6', fontSize: 11 }\n },\n yAxis: {\n type: 'category',\n data: data.departments.map(d => d.name),\n axisLine: { lineStyle: { color: '#1a3a6a' } },\n axisLabel: { color: '#8cb8e6', fontSize: 11 },\n axisTick: { show: false }\n },\n series: [\n {\n name: '一级',\n type: 'bar',\n stack: 'total',\n barWidth: 16,\n data: data.departments.map(d => d.level1),\n itemStyle: { color: colors[0] }\n },\n {\n name: '二级',\n type: 'bar',\n stack: 'total',\n data: data.departments.map(d => d.level2),\n itemStyle: { color: colors[1] }\n },\n {\n name: '三级',\n type: 'bar',\n stack: 'total',\n data: data.departments.map(d => d.level3),\n itemStyle: { color: colors[2] }\n },\n {\n name: '四级',\n type: 'bar',\n stack: 'total',\n data: data.departments.map(d => d.level4),\n itemStyle: { color: colors[3] }\n }\n ]\n }\n this.chart.setOption(option)\n }\n }\n}\n</script>\n\n<style lang=\"scss\" scoped>\n.safety-level {\n height: 100%;\n}\n.chart-area {\n width: 100%;\n height: 240px;\n}\n</style>\n"],"mappings":";;AAUA,YAAAA,OAAA;AACA,SAAAC,mBAAA;AAEA;EACAC,IAAA;EACAC,KAAA;IACA;MAAAC,KAAA;IAAA;EACA;EACA,MAAAC,QAAA;IACA,MAAAC,GAAA,SAAAL,mBAAA;IACA,KAAAM,SAAA,YAAAC,SAAA,CAAAF,GAAA,CAAAH,IAAA;EACA;EACAM,cAAA;IACA,SAAAL,KAAA,OAAAA,KAAA,CAAAM,OAAA;EACA;EACAC,OAAA;IACAH,UAAAL,IAAA;MACA,KAAAC,KAAA,GAAAJ,OAAA,CAAAY,IAAA,MAAAC,KAAA,CAAAT,KAAA;MACA,MAAAU,MAAA;MACA,MAAAC,MAAA;QACAC,OAAA;UACAC,OAAA;UACAC,eAAA;UACAC,WAAA;UACAC,SAAA;YAAAC,KAAA;UAAA;QACA;QACAC,MAAA;UACAC,GAAA;UACAC,KAAA;UACAJ,SAAA;YAAAC,KAAA;YAAAI,QAAA;UAAA;UACAC,SAAA;UACAC,UAAA;QACA;QACAC,IAAA;UAAAC,IAAA;UAAAL,KAAA;UAAAD,GAAA;UAAAO,MAAA;QAAA;QACAC,KAAA;UACAC,IAAA;U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