| | |
| | | <img src="/cockpitPage/machine-top.png" alt="" /> |
| | | <div class="top-title"> |
| | | <span>机器开机率</span> |
| | | <span class="top-rate">{{ "60%" }}</span> |
| | | <span class="top-rate">{{ startupRate + "%" }}</span> |
| | | </div> |
| | | </div> |
| | | <div class="chart" ref="chart"></div> |
| | |
| | | <script> |
| | | //引入echart |
| | | import * as echarts from "echarts"; |
| | | let myChart; |
| | | export default { |
| | | components: {}, |
| | | props: {}, |
| | | props: { |
| | | startupRate: { |
| | | type: String, |
| | | default: "", |
| | | }, |
| | | }, |
| | | data() { |
| | | return {}; |
| | | }, |
| | | mounted() { |
| | | let chartData = [ |
| | | { value: 20, name: "闲置" }, |
| | | { value: 20, name: "维修" }, |
| | | { value: 60, name: "工作" }, |
| | | ]; |
| | | this.pieChart("chart", chartData); |
| | | }, |
| | | mounted() {}, |
| | | watch: {}, |
| | | methods: { |
| | | //在职 |
| | | pieChart(chartName, data) { |
| | | let chartDom = this.$refs[chartName]; |
| | | let myChart = echarts.init(chartDom); |
| | | |
| | | if (myChart != null && myChart != "" && myChart != undefined) { |
| | | myChart.dispose(); //销毁 |
| | | } |
| | | myChart = echarts.init(chartDom); |
| | | let img = "/cockpitPage/machine-chart-bg.png"; |
| | | let option; |
| | | if (data) { |
| | |
| | | label: { |
| | | color: "#01f7fd", |
| | | fontSize: 14, |
| | | padding: [0, -60], |
| | | formatter: function (params) { |
| | | return `{a|${params.name}} {b|${params.value + "%"}}`; |
| | | }, |
| | |
| | | }, |
| | | labelLine: { |
| | | show: true, |
| | | length: 50, |
| | | length: 40, |
| | | color: "blue", |
| | | length2: 70, |
| | | }, |
| | | labelLayout: { |
| | | verticalAlign: "bottom", |
| | | dy: -5, |
| | | }, |
| | | data: data, |
| | | }, |