| | |
| | | <template> |
| | | <div class="file-format" ref="chart"></div> |
| | | <div class="FileFormat" ref="chart"></div> |
| | | </template> |
| | | |
| | | <script> |
| | | import * as echarts from "echarts" |
| | | import { countFileFormat } from "@/api/screen.js" |
| | | import { countFileFormat, countProjectType } from "@/api/screen.js" |
| | | export default { |
| | | props: { |
| | | params: { |
| | | type: Object, |
| | | default: () => null, |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | option: {}, |
| | | } |
| | | }, |
| | | watch: { |
| | | params : { |
| | | deep: true, |
| | | immediate: true, |
| | | handler(newVal) { |
| | | this.initChart() |
| | | }, |
| | | }, |
| | | }, |
| | | mounted() { |
| | | this.initChart() |
| | |
| | | value: 20, |
| | | }, |
| | | ] |
| | | const res = await countFileFormat() |
| | | const res = await countProjectType(this.params) |
| | | if (res.code == 200) { |
| | | data = res.result.map(item => { |
| | | return { |
| | | name: item.type, |
| | | value: item.count, |
| | | value: item.number, |
| | | } |
| | | }) |
| | | } |
| | | data.sort((a, b) => b.value - a.value) |
| | | data = data.slice(0, 10) |
| | | data = data.slice(0, 4) |
| | | let getArrByKey = (data, k) => { |
| | | let key = k || "value" |
| | | let res = [] |
| | |
| | | let option = { |
| | | backgroundColor: "transparent", |
| | | grid: { |
| | | top: "2%", |
| | | bottom: "2%", |
| | | top: "10%", |
| | | bottom: "10%", |
| | | right: "5%", |
| | | left: "10%", |
| | | containLabel: true, |
| | |
| | | </script> |
| | | |
| | | <style lang="less" scoped> |
| | | .file-format { |
| | | .FileFormat { |
| | | width: 100%; |
| | | height: 100%; |
| | | height: calc(100% - 40px); |
| | | } |
| | | </style> |